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.
eg:
Process.Start(exe1ForCopying_A_50_Mb_File);      
Process.Start(exe2ForCopying_A_10_Mb_File);  
Process.Start(exe3ForCopying_A_20_Mb_File);
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).
Any suggestions?
Thanks.
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 :) 
Thanks for the suggestion VAShhh..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With