Assuming this is a Windows 7 machine - and we're talking about batch scripts on the Windows command line.
Imagine I want to start and stop two different processes running in the background, and run things whilst they running in the background. For example:
START /B CMD /C tomcatA.bat
doSomeStuff
stopTomcatACmd
START /B CMD /C tomcatB.bat
doSomeStuff
stopTomcatBCmd
I'm trying to figure out how to implement the stopTomcatBCmd
. On a Linux machine you could just kill
the pid
.
My question is: How do I kill a specific process running in the background in Windows?
I think taskkill is what you're looking for. With it you can kill a running process by its ID or image name (name of the .exe file).
You can read a detailed usage explanation on this page: http://www.computerhope.com/taskkill.htm