Run console application from other console app

前端 未结 6 1947
耶瑟儿~
耶瑟儿~ 2020-12-02 18:40

I have a C# console application (A). I want to execute other console app (B) from within app A (in synchronous manner) in such way that B uses the same command window. When

6条回答
  •  一生所求
    2020-12-02 19:09

    You can use Process.Start to start the other console application.

    You will need to construct the process with ProcessStartInfo.RedirectOutput set to true and UseShellExecute set to false in order to be able to utilize the output yourself.

    You can then read the output using StandardOutput.ReadToEnd on the process.

提交回复
热议问题