Quickly kill Windows programs from a batch file using taskkill

killbill I’m an application developer by day and sometimes when I’m testing something out things don’t go so well, the program hangs, and I have to open the Windows Task Manager and end the program.

Sometimes I have to do this many time in one hour, depending what I’m testing and how far along it is in development.

This works great, but it can be a real drag if you have to do it a lot.

Thankfully, if you’re using Windows XP there is a way to automate this using a relatively unknown command called “taskkill”.

Here’s an example of how to use it:

taskkill /im acrodist.exe /f

I chose to use an Adobe Acrobat file in my example but it could be the name of any process that’s currently running.

/im is the image name, which is basically just telling taskkill that you’re about to kill a process by name and what follows is the name of that process.

/f tell is to force the program closed. Don’t ask about it, don’t think about it, close it.

To find out what the process name is, just look at the Processes tab in the Windows Task Manager and in the Image Name column are the programs that are currently running. When you find the one you want to kill, just use it in place of “acrodist.exe” in the above example (make sure and type it exactly as you see it, so if it says “javaw.exe” then type “javaw.exe”).

I created a simple batch job to close the program for me, so when I need to kill a process no more searching for it, selecting it, clicking “End Process”, waiting, confirming, then seeing it go away. I just double-click the batch file (which I’ve saved to my Desktop), and a moment later the program has been killed.

For more details about how to use the taskkill command see Microsoft’s documentation here.

Leave a Reply

You must be logged in to post a comment.