vb.net check if process I started is done

vb.net

Solution

You can check the HasExited property of the process. It will return true if the process has ended, and false if it is still running.

You will need to check this before you call `Close()` on your `getUpdate` Process object. So `getProcess` will have to remain open until the procsses has exited.

Problem

I have started a process: ``` Dim getUdpate as Process getUpdate = New Process getUpdate.StartInfo.FileName = "C:\UTIL\GETBTCH.BAT" getUpdate.StartInfo.WindowStyle = ProcessWindowStyle.Hidden getUpdate.StartInfo.UseShellExecute = False getUpdate.StartInfo.WorkingDirectory = "C:\UTIL\" getUpdate.Start() getUpdate.Close() ``` Then, I want to Run another process but I want to check first if the `getUpdate` process is already finished. How do I check if the process is already finished? I already tried to look at the processes ID, but it only display cmd.exe and there are a lot of cmd.exe as the processes ID so I can't just go and stop all of those.

Original source