I am creating an application in C# which calls a batch file, then executes another .net exe file and then runs another batch file when the exe file is closed.
I can run the initial batch file and I can call the exe file using the Process.start(my.exe); method but how can I check when the exe file is finally terminated so that I can run the final batch file?
You can either call WaitForExit():
Or, enable events and hook code on the exited event:
…
The key difference is synchronous or asynchronous. From the exited docs:
Also, when you get to running batch file, check out this post:
How to execute a batch file from C#?