從.NET應用程序(C#)捕獲控制臺輸出如何從.NET應用程序調用控制臺應用程序并捕獲控制臺中生成的所有輸出?(請記住,我不想先將信息保存在文件中,然后再重放,因為我希望以現(xiàn)場方式接收它。)
3 回答

慕森卡
TA貢獻1806條經(jīng)驗 獲得超8個贊
Process compiler = new Process();compiler.StartInfo.FileName = "csc.exe";compiler.StartInfo.Arguments = "/r:System.dll /out:sample.exe stdstr.cs";compiler.StartInfo.UseShellExecute = false;compiler.StartInfo.RedirectStandardOutput = true;compiler.Start(); Console.WriteLine(compiler.StandardOutput.ReadToEnd());compiler.WaitForExit();
- 3 回答
- 0 關注
- 936 瀏覽
添加回答
舉報
0/150
提交
取消