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.
Fire Your Computer Guy!
A computer technician spills the beans and makes available the knowledge he has charged clients hundreds in service fees for. It is Computer Secrets Unleashed. Find Out More.


Jason Faulkner is the man who brings you our daily tips. He is based in Atlanta, Georgia.

PCMech was founded by 

Loren said:
3/15/2007 11:35 am
Windows couldn’t find “taskkill” (nor “taskill”.) Where is the executable located? Is this command specific to a particular Windows version? (I’m running 2000.)
[Reply]
jfaulkner said:
3/19/2007 8:21 am
Windows 2000 does not install this tool by default. For Windows 2000 support, you will need to install the Support Tools.
You can get more information as well as download and install the tools from Microsoft:
http://www.microsoft.com/windows2000/downloads/servicepacks/sp4/supporttools.mspx
[Reply]