Trying to get StandardOutput after running a console process

后端 未结 2 1225
我在风中等你
我在风中等你 2021-01-23 14:19

I can run a console process using the following C# code. The goal is also to collect all the output from such process:

System.Diagnostics.Process proc = new Syst         


        
2条回答
  •  轮回少年
    2021-01-23 14:55

    Seeing as the line you are missing seems like an error message, should you not be looking at Process.StandardError Property

    When a Process writes text to its standard error stream, that text is normally displayed on the console. By redirecting the StandardError stream, you can manipulate or suppress the error output of a process. For example, you can filter the text, format it differently, or write the output to both the console and a designated log file.

提交回复
热议问题