Redirection of standard and error output appending to the same log file

前端 未结 4 662
孤街浪徒
孤街浪徒 2020-11-30 00:27

I need to collect the standard output and error log from several processes into one single log file.

So every output must append to this log file.

4条回答
  •  Happy的楠姐
    2020-11-30 01:05

    Maybe it is not quite as elegant, but the following might also work. I suspect asynchronously this would not be a good solution.

    $p = Start-Process myjob.bat -redirectstandardoutput $logtempfile -redirecterroroutput $logtempfile -wait
    add-content $logfile (get-content $logtempfile)
    

提交回复
热议问题