Monday, October 16, 2006

pList - Process management for the command line

Here is a little application I wrote to manage processes from the command line (Kind of Task Manager for the command line). Anyone who has used Linux/Unix or OS X (I guess that would fall under the Unix category) knows how easy it is to list and kill processes from the command line. A while back -- when I was using OS X on a frequent basis -- it was driving me nuts not having the "ps" and "kill" command in Windows, so I wrote this little app to remedy my frustrations.

Here is a brief overview of it's functionality. It is basic and pretty straight forward, but I will add functionaliy as I need it.

c:\>plist /?

Usage:
List Running Processes: pList.exe
Kill Running processes: pList.exe [PID 1] [PID 2]...
Kill Running processes: pList.exe [Process Name 1] [Process Name 2]...
List Running processes that start with specified parameter:
pList.exe -l [Process Name 1] [Process Name 2]...

c:\>


So if I want to list all processes that start with s I would type:

c:\>plist -l s

Process Name        PID     Mem(KB)   Virtual Mem(KB)
------------ --- ------- ---------------
sqlwriter 1732 232 20,336
sqlservr 1232 21,532 1,131,828
spoolsv 604 3,116 49,412
------------ --- ------- ---------------
Process Name PID Mem(KB) Virtual Mem(KB)


c:\>


Now if I wanted to kill sqlwriter I could do it one of two ways:
c:\>plist 1732


or

c:\>plist sqlwriter


Depending on which way I write it, the following will be returned

Process 1732 has been terminated.

or

Process sqlserver has been terminated.

Now, you may have to processes with the same name running (i.e. cmd.exe, svhosts, etc). If you specify a name (sqlwriter from the example above) it will kill all processes with that name. For example, open for or five command prompt windows (cmd.exe) and then type:


c:\>plist cmd


pList will kill all of the cmd processes (including the one you used to run the command).

Anyway, a useful little tool. I will add some more wild card features and probably remoting so you can manage processes on another computer on your local network. If anyone has any suggestions for ideas just let me know.



pList.exe pList_src.zip

* You will need the .Net Framework 2.0 to run this app

No comments: