Saturday, December 17, 2016

command line - Windows - Start a batch script in background and stop it once other tasks are done


I have a Jenkins project that needs to run a batch script while it executes other commands. So the script would need to be run in background. I would also like to stop the background script once my other commands are done executing.


I started experimenting with the START /B myscript.bat, but couldn't find a way to stop the myscript.bat by its name. Is there an easy way to stop background batch processes?


Answer



Is there an easy way to stop background batch processes?


Yes. You can use taskkill.


Example:


taskkill /f /fi "windowtitle eq Administrator: Command Prompt - myscript.bat"



Further Reading


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...