Paedow Paedow - 19 days ago 7
C# Question

How can I start a new Process and wait until it finishes?

I want to start a program with C# (could use

Process.Start()
). Then my program should wait until the started program is closed, before it continues.

How do I do this?

Answer

After your Start() call, add: use Process.WaitForExit()

 var myProcess = new Process {StartInfo = new ProcessStartInfo(processPath)};
   myProcess.Start();
   myProcess.WaitForExit();