How to kill (stop) a Process from Command Prompt in Windows NT/2000/XP?

The ability to perform tasks from a system’s command line allows those tasks to be used in batch files. This simple trick describes several uses of taskkill to terminate Windows processes.

Usually to stop a process, you start task manager, select the Processes tab, select the process and click “End Process”. However, you can also accomplish the same from the command prompt. For this, first you would need to know the name of the process that you want to kill/stop. To do so:

Open Command Prompt with alleviated privileges (Administrator) i.e yourdrive:\> Now in the command prompt, type tasklist and press Enter. This should give you a list of currently running tasks like below:

How to kill (stop) a Process from Command Prompt in Windows NT 2000 XP

Now since you know the name of the process to kill, for example notepad.exe, use the following command from the command prompt to end it:

taskkill /IM notepad.exe

This will cause the program to terminate gracefully, asking for confirmation if there are unsaved changes.  But sometimes this may not work. In such cases, to forcefully kill the same process add the /F option to the command line.

taskkill /IM notepad.exe /F

But be careful with the /F option as it will terminate all matching processes without confirmation.

To kill a single instance of a process, specify its process id (PID). For example, if the desired process has a PID of 827, use the following command to kill it:

taskkill /PID 827

Using filters, a variety of different patterns can be used to specify the processes to kill. For example, the following filter syntax will forcefully kill all processes owned by the user TechChunks:

taskkill /F /FI "USERNAME eq TechChunks"

Parameters:
eq: equals ne: not equal
gt: greater than lt: less than
gt: greater than or equal le: less than or equal

Hope this little tutorial helps you to kill a non-responding windows process from the command prompt using the taskkill command, in case the task manager also refuses to respond. Let us hear how it worked for you.

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *

19 − twelve =

CommentLuv badge