CLOSE

You've Found Us! Now Stay Connected...

Sign Up for PCMech.com's FREE weekly newsletter. We'll help keep you informed on what's happening in the world of technology.


Privacy Policy | More Information

PCMech.com helps normal people get their geek on. We talk about computers, technology, the Internet, social media - anything that makes a geek feel warm and fuzzy inside.

home | about | newsletters |forums | contact | series | membership

Helping Normal People Get Their Geek On

Killing Windows Tasks From The Command Line

About this Post

Posted Mar 14, 2007 in

Tools



About the Author

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

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.

2 Comment(s)

  1. 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]

  2. 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]

Post a Comment

Members


Search

Lijit Search

Featured Product of The Day

Getting Started with Ubuntu Linux

Getting Started with Ubuntu Linux

Free Weekly Newsletter

Sign up! Exclusive weekly content, weekly rant, and more!

Name:
Email: