我在我的 C# 应用程序中使用 Process.Start()
执行 3 个 exe。我想按顺序运行所有这些 exe。现在,每个 Process.Start()
都以并行方式独立执行。
例如:
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 分钟)。
有什么建议吗?
谢谢。
最佳答案
我想我自己得到了答案..! :)
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 的建议..
关于c# - 在C#中顺序执行多个Process.Start(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6251224/