Capturing console output from a .NET application (C#)

后端 未结 8 2270
臣服心动
臣服心动 2020-11-22 02:20

How do I invoke a console application from my .NET application and capture all the output generated in the console?

(Remember, I don\'t want to save the information

8条回答
  •  你的背包
    2020-11-22 03:07

    Use ProcessInfo.RedirectStandardOutput to redirect the output when creating your console process.

    Then you can use Process.StandardOutput to read the program output.

    The second link has a sample code how to do it.

提交回复
热议问题