Getting the PID of a spawned process

4 posts in this topic

lyledg 0

I have coded a GUI that calls robocopy.exe, and as part of the exit routine of this GUI I want to check if the robocopy process is running. That is easy enough to do, but what if I had multiple instances of robocopy.exe running on the same box.

Question is: How do I ensure programatically that I have ended only my latest instance of robocopy.exe that was created through my compiled GUI.

I want to kill the PID rather than exe name, as I assume the latest PID of Robocopy.exe in task manager will be the latest process correct?