我执行3 EXE文件用的Process.Start()
在我的C#应用程序。我想按顺序运行所有这些前男友。现在,每个的Process.Start()
以并行方式执行自己。
I'm executing 3 exes using Process.Start()
in my C# application. I want to run all these exes sequentially. Right now, each Process.Start()
executes on its own in a parallel manner.
例如:
Process.Start(exe1ForCopying_A_50_Mb_File);
Process.Start(exe2ForCopying_A_10_Mb_File);
Process.Start(exe3ForCopying_A_20_Mb_File);
我想我的第二的Process.Start()
开始执行后,才第一次的Process.Start()
有完成复制50 MB的文件(这将采取大约1或2分钟)。
I want my 2nd Process.Start()
to start executing ONLY AFTER first Process.Start()
has finished copying the 50 Mb file (which would be taking around 1 or 2 minutes).
有什么建议?
感谢。
我觉得我得到了自己的答案..! :)
I think I got the answer myself..! :)
Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = MyExe;
startInfo.Arguments = ArgumentsForMyExe;
process.StartInfo = startInfo;
process.Start();
process.WaitForExit(); // This is the line which answers my question :)
感谢您的建议VAShhh ..
Thanks for the suggestion VAShhh..