XP’s Powerful “Tskill” and “Taskkill” Commands

You probably know that in XP (all versions), Ctrl-Alt-Del doesn’t reboot the PC (as it does in Win98), but rather brings up the Task Manager, which shows you (among other things) all the top-level tasks (like "Word," "Excel," "Eudora" or what not) that are running; and the individual low-level processes created or controlled by the operating system and the top-level tasks.

You can use the Task Manager to terminate a hung or errant task or process. You simply select it from the list and click "End Task" or "End Process."

Of course, you also can use this to kill a task or process that isn’t hung, although you must do so with caution: A forced exit may cause you to lose any unsaved data generated by a task, for example. But if there is no unsaved data in play, then usually no harm is done.

But you don’t really need Task manager for that: The "Tskill" command (without the quotes) actually can do the same thing. If you’re running a program called XYZ, you can kill it by typing


on the Start/Run line, or by entering that command in a Command window, or via script or batch file. As long as XYZ has no open files or unsaved data, it will close, and that’s that.

You can see for yourself with a 15 second test: Open an empty Notepad, then click to Start/Run. Type TSKILL NOTEPAD /A and click OK. Presto: Notepad will close.

This can be a powerful automation tool. For example, I use it in a late-night batch file to make sure certain programs are not running when a long maintenance task is about to begin. It’s a kind of selective shutdown that lets me close top-level programs; and, as long as they’re not applications that contain unsaved data, there’s no problem.

Both XP Home and Pro support Tskill, but XP Pro also has an even more powerful tool called TASKKILL. It’s a little harder to use, but much more flexible in what it can shut down— even if the software balks and doesn’t want to "let go." For example,

taskkill /f /im XYZ.EXE

will almost surely cause XYZ to shut down, no matter what!

Both Tskill and Taskkill have additional switches, and there’s plenty of documentation available, which I won’t duplicate here. Just search for Tskill and Taskkill in Start/Help, and you’ll get all the info you need, including usage notes, and important cautions.

Additional info:
Tskill: http://langa.com/u/3p.htm

Taskkill: http://langa.com/u/3o.htm

Win2k’s Taskkill:


Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 10, Windows 8, Windows 7, Firefox, Internet Explorer, Google, etc. Join our 460,000 subscribers!

Enter your email above to receive messages about offerings by Penton, its brands, affiliates and/or third-party partners, consistent with Penton's Privacy Policy.
The Windows 7, Vol 3 (Excerpt)

Subscribe and get our monthly bonuses - free!

The Windows 7 Guide, Volume 3: Advanced maintenance and troubleshooting provides advanced tools for keeping Microsoft's premier operating system up and running smoothly. Get this excerpt and other 4 bonuses if you subscribe FREE now!

Fred Langa

About Fred Langa

Fred Langa is senior editor. His LangaList Newsletter merged with Windows Secrets on Nov. 16, 2006. Prior to that, Fred was editor of Byte Magazine (1987 to 1991) and editorial director of CMP Media (1991 to 1996), overseeing Windows Magazine and others.