If you write batch files which run scheduled processes, this tip is for you. Often times when I run a nightly scheduled tasks, they will fail if a certain other process is running already. This proves very annoying because I have to remember to run the task the next day manually.
The solution to this is using the Windows command “taskkill” before executing the commands. When the following is added to the front of my batch file:
taskkill /im stopthis.exe /t /f
I’m assured “stopthis.exe” will not interfere with my scheduled process. Of course this is an “ungraceful” way stop the task but it assures me it will not be running.
You can get more information on the taskkill command by entering the following at the command prompt:
taskkill /?
Happy scripting.

Like what you read?
If so, please join over 28,000 people who receive our exclusive weekly newsletter and computer tips, and get FREE COPIES of 5 eBooks we created, as our gift to you for subscribing. Just enter your name and email below:







