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"
No comments:
Post a Comment