1 string exeFileName = ""; 2 3 System.Diagnostics.Process process = new System.Diagnostics.Process(); 4 5 process.StartInfo.FileName = exeFileName;//设置执行文件名称 6 7 process.StartInfo.RedirectStandardOutput = true; 8 9 process.StartInfo.UseShellExecute = false; 10 11 process.StartInfo.CreateNoWindow = true; 12 13 process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; 14 15 //创建参数 16 17 int a = 0, b = 0, c = 0; 18 string arguments = String.Format("{0} {1} {2}", a, b, c); 19 20 process.StartInfo.Arguments = arguments; process.Start(); process.WaitForExit();//等待程序执行完成 21 Console.WriteLine(process.StandardOutput.ReadLine());//打印输出调用程序中Console.WriteLine写的内容。
时间: 2024-10-19 17:21:34