The tasklist and taskkill Commands
If you’re used to the Unix command PS, then you might be interested to know that recent versions of Windows has a little known command called tasklist. It’s very similar to the Unix command that displays the list of running processes with an associated process ID (known as a PID). There is a relative of tasklist called taskkill, that can be used to kill a process from the command line.
Why is this useful? For starters, you get a much more detailed view of what is currently running on your system. The details are above and beyond what you can see using “Task Manager”, for example. These commands can also be easily scripted, which is useful for automation.
Here is some sample output displayed when the tasklist command is run:
C:\>tasklist
svchost.exe 3188 Console 0 4,180 K
OUTLOOK.EXE 968 Console 0 14,468 K
WINWORD.EXE 3344 Console 0 47,132 K
firefox.exe 212 Console 0 83,272 K
cmd.exe 1712 Console 0 2,760 K
tasklist.exe 3900 Console 0 5,756 K
To kill the firefox.exe task, all you have to do is enter:
C:\>taskkill /PID 212
SUCCESS: The process with PID 212 has been terminated.
There are many more options, simply type in taskkill /? for more information.
Note: If you’re looking for a GUI replacement for Task Manager, look no further than Mark Russinovic’s Process Explorer.
Written by webmaster on January 4th, 2007 with
comments disabled.
Read more articles on Articles.
- [+] Digg: Feature this article
- [+] Del.icio.us: Bookmark this article
- [+] Furl: Bookmark this article