2

We have this process and we want to know if the process is done? How we'll be able to check if it is done?

Here is the code:

Process.Start(filePath & ".bat", filePath.Substring(0, filePath.LastIndexOf("\")))

thanks

slek
  • 309
  • 6
  • 17

1 Answers1

4

There are several properties/methods you can use after you have saved the return value of Process.Start to a variable:

  • If you want to wait until the Process has exited, use the WaitForExit method.
  • If you want to check whether the Process is still running, use the HasExited property.
  • If you need the exit code after the Process has ended, use the ExitCode property.

For an overview of the Process class and its capabilities, see this link.

Sample:

Dim p As Process = Process.Start(filePath & ".bat", filePath.Substring(0, filePath.LastIndexOf("\")))
p.WaitForExit()
Markus
  • 20,838
  • 4
  • 31
  • 55