≡ Menu

TaskKill: Kill process from command line (CMD)

We can kill a process from GUI using Task manager. If you want to do the same from command line., then taskkill is the command you are looking for. This command has got options to kill a task/process either by using the process id or by the image file name.

Kill a process using image name:

We can kill all the processes running a specific executable using the below command.

taskkill /IM executablename

Example:
Kill all processes running mspaint.exe:

c:\>taskkill /IM mspaint.exe
SUCCESS: Sent termination signal to the process "mspaint.exe" with PID 1972.

Kill a process forcibly

In some cases, we need to forcibly kill applications. For example, if we try to to kill Internet explorer with multiple tabs open, tasklist command would ask the user for confirmation. We would need to add /F flag to kill IE without asking for any user confirmation.

taskkill /F /IM iexplore.exe

/F : to forcibly kill the process. If not used, in the above case it will prompt the user if the opened pages in tabs need to be saved.

To kill Windows explorer, the following command would work

C:\>taskkill /F /IM explorer.exe
SUCCESS: The process "explorer.exe" with PID 2432 has been terminated.

The above command would make all GUI windows disappear. You can restart explorer by running ‘explorer’ from cmd.

C:\>explorer

Not using /F option, would send a terminate signal. In Windows 7, this throws up a shutdown dialog to the user.

C:\>taskkill /IM explorer.exe
SUCCESS: Sent termination signal to the process "explorer.exe" with PID 2432.
C:\>

Kill a process with process id:

We can use below command to kill a process using process id(pid).

taskkill /PID  processId

Example:
Kill a process with pid 1234.

taskkill /PID 1234

Kill processes consuming high amount of memory

taskkill /FI "memusage gt value"

For example, to kill processes consuming more than 100 MB memory, we can run the below command

taskkill /FI "memusage gt 102400"

More examples

Sometimes applications get into hung state when they are overloaded or if the system is running with low available memory. When we can’t get the application to usable state, and closing the application does not work, what we usually tend to do is kill the task/process. This can be simply done using taskkill command.

To kill Chrome browser from CMD

Taskkill /F /IM Chrome.exe

Kill Chromedirver from command line

Taskkill /F /IM Chromedriver.exe

To kill firefox browser application

taskkill /F /IM firefox.exe

To kill MS Word application(Don’t do this if you haven’t saved your work)

taskkill /F /IM WinWord.exe

Sometimes, the command window itself might not be responding. You can open a new command window and kill all the command windows

taskkill /F /IM cmd.exe

This even kills the current command window from which you have triggered the command.

30 comments… add one
  • Karim

    Hi,

    i have a question about this.
    I have a process that runs in my domain that puts outlook suspended. As soon as I do a task kill forced as administrator it runs.

    I wrote a little script, now i want to add admin rights to the script via GPO.

    Can you help me with that?

    Kind regards,

    Karim

  • Eric

    Taskkill /f /Im V4GLTE.exe

  • Rishabb

    Hello,

    I want to kill 3 images once a condition is matches,
    taskkill /fi “USERNAME eq %USERNAME%” /im java.exe ssonsvr.exe wfshell.exe

    could anyone tell me what is the right syntax to do so?

    Thanks

  • Jay

    How can keep the line below from showing in the open DOS box?

    SUCCESS: The process “program.exe” with PID 2868 has been terminated.

    • Anonymous

      taskkill /f /im blah > nul

  • fight

    im just saying on admin cmd command like this: (taskkill /f /im wininit.exe /t ) and my windows frezze and blue screen of death hehehe im was very stupid

    • Kris256

      Now set it as a startup item or a task in the task manager!

    • .

      That’s gonna crash their computer forever, resulting that you will need to buy a new computer o-o

  • Aysar A Ali

    I didn’t see how to kill specific file.
    for example i have three A.docx, B.docx, and C.docx files and I want kill just A.docx.
    if I use taskkill /IM winword.exe then I will kill all of them.

    • Srini

      When you kill with image name, it kills every process so all files would be closed. To kill a Word session for a specific file, use the process id.

  • ilana

    I use this command: taskkill /IM iperf.exe /F from regular command line window and it fails but when I run same command from command line that was run as administrator – it works fine – why and what can be done?

    • John Doe

      Well, its clear that you need be administrator for kill this processes ;)

  • Dan

    But how can you taskkill all??

    • Stephen B Kaiser

      Hold down the power button for 10 seconds or run the command “shutdown /s”

  • AMIT SHARMA

    Open command prompt with administrator

    in command prompt, type following command
    taskkill /IM Excel.exe

    and press enter

  • Sebastian

    how to kill my Wifi or internet access if my VPN dies? I mean there is a specific task to kill-close immediately my internet?

  • Enzo

    Please how to kill a program as administrator.
    I have created a cmd file with the comand taskkill /im programname /f
    but it doesn’t kill the program, so put at the end the comand pause to see what happened
    and have noticed that it gave me access denied.
    Please how can i do?
    Thanks
    Enzo

    • Annoymous

      Use Taskkill /t /f /im `your cmd file name`
      /t terminate all process including sub-ones
      /f with force
      /im with image name

  • irfan

    ok..can any say how we can able find PORT
    number just by typing the PROCESS ID

  • Annoymous

    Be careful never user *taskkill /t /f /im explorer.exe* or your desktop will disappear!

    • w

      or in that case;
      Press the Windows key + r
      Type explorer.exe
      press enter

  • Diwakar Sharma

    is there any way to kill specific tab of chrome through this taskkill as if we use chrome.exe to kill ,it will terminate all the processes.

  • Ahmad

    I have a program and when I close that, it displays a OK / Cancel message window. How can I pass ‘OK’ to TASKKILL command. Please help……

  • asdf

    I dont want to open cmd every time is it possible to make a .bat file that can auto-kill the process?
    for example:
    taskkill /f /im GTA5.exe

  • Hari

    How to kill a process based on command line, since many process run with same name.
    Example ade.exe ade.exe, I want to kill only one based on command line. I’m not supposed to use pid to kill the process

  • Is there any way to just end all programs in one go?

    • I also just found the awnser to my own question: taskkill /F /T /FI “memusage gt 1”

  • user

    How do I kill the administrator?
    He is a very annoying person…

  • How do I close a specific tab in chrome using batch file?

  • CityguyUSA

    Why can’t I get this to kill all cmd.exe?

    taskkill /f /im cmd.exe will only work on a single instance. If you have more than 1 instance it will not kill any instances.

Leave a Comment