How to stop a bat process on Windows?
Processes usually get launched in a tree like fashion, I would advise launching Microsoft / Sysinternals Process Explorer, Start by clicking on the Show Process Tree
(1) option, then find your process and right click and choose Kill Process Tree
(2) This should kill both the original file and everything that it has launched.
You can modify the batch file so that it uses a lock-file to continue operating, by inserting checks between commands for the existence of the file. To stop the batch file from executing, just delete the lock-file.
Here is a demo batch file:
echo xx > "c:\temp\lockfile"
pause
if not exist "c:\temp\lockfile" goto exit
pause
del "c:\temp\lockfile"
:exit
To violently kill the processes that might be executing at the moment, you can create a 'kill' batch file that will contain taskkill commands for all the tasks possibly launched from the batch file:
del "c:\temp\lockfile"
taskkill /im mytask1.exe
taskkill /im mytask2.exe