How To: Execute command line in C#, get STD OUT results

后端 未结 17 1237
既然无缘
既然无缘 2020-11-21 13:12

How do I execute a command-line program from C# and get back the STD OUT results? Specifically, I want to execute DIFF on two files that are programmatically selected and wr

17条回答
  •  迷失自我
    2020-11-21 14:09

    You will need to use ProcessStartInfo with RedirectStandardOutput enabled - then you can read the output stream. You might find it easier to use ">" to redirect the output to a file (via the OS), and then simply read the file.

    [edit: like what Ray did: +1]

提交回复
热议问题