将控制台输出重定向到单独程序中的文本框
void Method() { var p = new Process(); var path = @"C:\ConsoleApp.exe"; p.StartInfo.FileName = path; p.StartInfo.UseShellExecute = false; p.OutputDataReceived += p_OutputDataReceived; p.Start(); } static void p_OutputDataReceived(object sender, DataReceivedEventArgs e) { Console.WriteLine(">>> {0}", e.Data); }
慕村9548890
相关分类