Categories: Windows Commands

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 the command line in Windows 11 or Windows 10, then taskkill is the command you are looking for. This command has options to kill a task/process either by using the process id or by the image file name.

Save your work before using these commands. Using /F can lose unsaved changes.

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. We can add the /F flag to taskkill for this. For example, to forcibly close Microsoft Edge, run the below command.

taskkill /F /IM msedge.exe

This targets all running Microsoft Edge processes named msedge.exe, not just one tab or window. Unsaved work may be lost.
/F : to forcibly kill the process. Do not rely on a save prompt when using this option.

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 closes Explorer windows and can make the desktop and taskbar disappear. It does not close every application. You can restart explorer by running ‘explorer’ from cmd.

C:\>explorer

Not using /F sends a termination request. In the original Windows 7 example below, this opened a shutdown dialog.

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 the command below to kill a process using process ID (PID).

taskkill /PID processId

We can find the PID by running tasklist.
Example:
Kill a process with PID 1234.

taskkill /PID 1234

To also kill child processes started by this process, add /T. Use this only if you intend to close those child processes too.

taskkill /PID 1234 /T

Kill processes consuming a high amount of memory

taskkill /FI "memusage gt value" /IM *

The memory value is in KB. First list the processes using more than 102400 KB (100 MB):

tasklist /FI "memusage gt 102400"

The below command targets all matching processes, not just the application you are troubleshooting. Check the list and save your work before running it. To close only one process, use its PID instead.

taskkill /FI "memusage gt 102400" /IM *

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 ChromeDriver 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.

Srini

View Comments

  • Using taskkill in Matlab to kill Chrome, how do I prevent taskkill from outputting all the kill information?

  • 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.

  • 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

  • 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

    • Yes. Create a batch file with your command. Store the batch file in a folder on the hard drive. Create a shortcut to the batch file and place it on your desktop. Right-Click the Shortcut, go to Properties, Advanced, and check the box that says "Run as Administrator". Save the shortcut. Now when you open the shortcut, you will get the prompt to Run As Administrator, then you just click "Yes". Even with admin rights, you will still get the prompt.

  • 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......

  • 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.

Recent Posts

Manage Print Jobs in Windows 11 & 10 Using PowerShell

Use PowerShell to list, pause, resume, and cancel print jobs in Windows 11 and Windows…

6 days ago

Add New User Account from Command Prompt (CMD)

Create local or domain user accounts from Command Prompt in Windows 11 and Windows 10…

4 years ago

Delete directory from command line [Rmdir]

Do you want to delete a directory from Windows Command Prompt (CMD)? This post explains…

4 years ago

Kill Chrome from command line

Chrome is definitely the stable browser compared to other ones and it has been my…

4 years ago

Find Windows OS version from command line

Windows has multiple command line utilities that can help find the version of the Windows…

4 years ago

How to check if Windows 32 or 64 bit?

There are multiple ways to check whether a Windows computer is running 32-bit OS or…

7 years ago