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

TSKILL XYZ /A

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:
http://support.microsoft.com/?kbid=243202

General:
http://www.experts-exchange.com/Operating_Systems/Q_20810731.html



Subscribe to our Windows Secrets Newsletter - It's Free!

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

Windows 8 Hacks: Tips & Tools for Unlocking the Power of Tablets and Desktops

Subscribe and get our monthly bonuses - free!

Want to hack the new Start screen and tiles for your Win8 Device, the new Lock screen, the new tile-based apps, or the automatic notification information? Yes, you can do that. How about running other operating systems inside Windows 8, running Windows 8 on a Mac, or hacking SkyDrive and social media? We'll show you how to do that as well. Get this excerpt and other 5 bonuses if you subscribe 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.