Process a = new System.Diagnostics.Process(); a.StartInfo.FileName=@"C:\Users\Administrator\Desktop\ConsoleApplication1\ConsoleApplication1\bin\Debug";
a.StartInfo.UseShellExecute = false; //不使用系统外壳程序启动
a.StartInfo.RedirectStandardInput = true; //重定向输入(一定是true)
a.StartInfo.RedirectStandardOutput = true; //重定向输出
a.StartInfo.RedirectStandardError = true;
a.StartInfo.CreateNoWindow = true; //不创建窗口
a.Start();
textBox1.Text = cmd.StandardOutput.ReadToEnd();
a.WaitForExit();
a.Close();

a.StartInfo.UseShellExecute = false; //不使用系统外壳程序启动
a.StartInfo.RedirectStandardInput = true; //重定向输入(一定是true)
a.StartInfo.RedirectStandardOutput = true; //重定向输出
a.StartInfo.RedirectStandardError = true;
a.StartInfo.CreateNoWindow = true; //不创建窗口
a.Start();
textBox1.Text = cmd.StandardOutput.ReadToEnd();
a.WaitForExit();
a.Close();
