powershell输出错误信息到文件

https://stackoverflow.com/questions/8925323/redirection-of-standard-and-error-output-appending-to-the-same-log-file

 

The second way would look like this:

& myjob.bat 2>&1 >> C:\MyLog.txt

Or this:

& myjob.bat 2>&1 | Out-File C:\MyLog.txt -Append
posted @ 2017-09-27 17:23  ChuckLu  阅读(1300)  评论(0编辑  收藏  举报