Listing And Killing Tasks From The Command Prompt In Windows

June 2, 2011 by
Filed under: command line, HowTo, windows 

Most Linux users are familiar with using the ps and kill commands from the Linux terminal to list and kill processes. Many Windows users are also familiar with ending errant processes by using the Windows Task Manager. But what if Task Manager won't work? 

I have a Windows laptop for work. I had a situation last week where Windows Task Manager was flipping out. The window wouldn't close no matter what I tried. There's a way to list Windows processes from a Command Prompt window. This is similar to using the ps command in Linux.

List running tasks (processes)

tasklist

This will give you a list of the running processes on your computer. Find the process that you want to kill and make note of the process ID. If you need to filter the list to help find the offending process, Windows has a grep function similar to Linux & Unix. To list tasks and filter for the pattern "explore":

tasklist | grep explore

Kill a task

To kill a task with process ID 2500:

Affiliate Link
taskkill /pid 2500

Comments

2 Responses to “Listing And Killing Tasks From The Command Prompt In Windows”

  1. Sean Rhodes says:

    "tasklist | FindStr explore" is the alternative for grep in windows. Grep is not a standard tool (but can be added).

    • Linerd says:

      Thanks for the tip. Most of my Windows use is on my work computer which is far from a "standard" Windows build.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>