Thursday, 13 December 2012

Kill Windows processes from Command Prompt


Let us look into this in detail. Like unix system, a process in windows also can be killed by its process id. But first of all, you need to know what all processes are running in your system. To get the list of processes running in your system, use the below command.





You will get all the processes under column "Image Name" and all process Ids under PID. If you want to kill a particular process, you need to use the command “TASKKILL” and associate it with the process name or the process Id. Suppose, we would like to terminate the notepad process, then we can issue the below command





So, if you need to kill any process by its name, you need to add /IM with the command. Suppose, we need to kill a particular notepad process, we need to provide process id. See the below command for the same





I do like the command prompt killing process as it is more powerful and having lots of features. From many features of TASKKILL, my few favorite ones are as given below



1) Using the command prompt, we can kill all processes pertaining to a particular application together. As for example, in our last example, if we would like to kill all the notepad processes, using the taskkill command, the /IM parameter would suffice. You can even specify wild card in your process name.



2) You can provide filter along with the command. I like the most the filter on STATUS i.e. RUNNING, NOT RESPONDING and UNKNOWN. So if you would like to terminate all hung up processes, you can execute the below command




taskkill /FI "STATUS eq NOT RESPONDING"



You see how powerful is this tool where you need not to open task manager and find out the hung up processes.



3) You specify the /T parameter with taskkill command and it terminates all child processes when you terminate the parent process. So, you don’t face any issue of orphan process, as you experience in task manager.



4) Another feature, which I like the most, is the capability to kill a process in remote computer. The syntax for the same is



TASKKILL /S system /U username /P password /IM “taskname”



I hope that you found these features impressive and leverage this command prompt utility from time to time.















































{jcomments on}

No comments:

Post a Comment