日期:2014-05-20 浏览次数:21216 次
Console.WriteLine("控制台内容1 >>>"); Console.WriteLine("控制台内容2 >>>");
private void Form1_Load(object sender, EventArgs e) { Process Processer = new Process(); Processer.StartInfo.FileName = ""; Processer.StartInfo.RedirectStandardOutput = true; Processer.StartInfo.RedirectStandardInput = true; Processer.StartInfo.RedirectStandardError = true; Processer.StartInfo.UseShellExecute = false; Processer.Start(); Processer.BeginOutputReadLine(); Processer.OutputDataReceived+=ConsoleOutput; } public void ConsoleOutput(object sender,DataReceivedEventArgs e) { if (!string.IsNullOrEmpty(e.Data)) { //e.Data就是输出的内容 } }
------解决方案--------------------
Console.Readline();