Writing errors and output to a text file and Console

前端 未结 4 1892
走了就别回头了
走了就别回头了 2021-02-02 08:48

I am trying to write the entire output (errors included) of an executing script to the console and a file at the same time. I have tried several different options:



        
4条回答
  •  南方客
    南方客 (楼主)
    2021-02-02 09:45

    By default only the Success stream of data is passed on to the Output file. To direct errors and warnings you will have to add something like this :

    your script 3>&1 2>&1 | Out-file log.txt

提交回复
热议问题