Windows kill process by pid

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.

Sometimes when an application in Windows hangs, freezes and stops responding the only way to terminate it is to kill from the command-line.

The taskkill command in Windows serves for terminating tasks by name or by process id (PID).

In this note i am showing how to find and kill a process by its name or by PID and how to identify a process by the listening port.

I am also showing how to troubleshoot “The process could not be terminated” and “Access denied” errors.

Cool Tip: Get the return code from the last command or application! Read more →

List all Windows processes and find the full name of a process to kill (case insensitive):

C:\> tasklist | findstr /I process_name

Kill the process by name:

C:\> taskkill /IM process_name.exe

Kill Process by PID

List all Windows processes and find the PID of a process to kill (case insensitive):

C:\> tasklist | findstr /I process_name

Kill the process by PID:

C:\> taskkill /PID process_id

Kill Process by Port

List all Windows processes listening on TCP and UDP ports and find the PID of a process running on a specific port:

C:\> netstat -ano | findstr :port

Find the name of a process by its PID:

C:\> tasklist /FI "pid eq process_id"

Kill the process by name or by PID:

C:\> taskkill /IM process_name.exe
- or -
C:\> taskkill /PID process_id

Cool Tip: Windows grep command equivalent in CMD and PowerShell! Read more →

Troubleshooting

Kill the process forcefully in case of the following error:

ERROR: The process with PID XXX could not be terminated.
Reason: This process can only be terminated forcefully (with /F option).

C:\> taskkill /F /IM process_name.exe
- or -
C:\> taskkill /F /PID process_id

If you get an “Access is denied” error, you should open the command prompt as an administrator:

ERROR: The process with PID XXX could not be terminated.
Reason: Access is denied

To run the CMD as an administrator, press ⊞ Win keybutton to open the start menu, type in cmd to search for the command prompt and press Ctrl + Shift + Enter to launch it as administrator.

Was it useful? Share this post with the world!

When you start an app, the operating system creates a process for an executable file of the app. It contains the program code and its current activity. Windows assigns a special number known as Process Identifier (PID) which is unique for every process. There are a number of reasons you might want to kill a process, and different methods you can use to terminate it. Here is how it can be done.

If an app stops responding, consumes a lot of system resources or behaves unexpectedly and doesn’t allow you to quit it, you might want to kill its process to forcefully close the app. Traditionally, Windows allowed using Task Manager and the command prompt for these tasks. In addition to these methods, you can use PowerShell. Here is how.

To kill a process in Windows 10, do the following.

  1. Open Task Manager.
  2. Click on «More details» in the bottom right corner to enter Full view mode.Task Manager Windows 10 Show More Details
  3. Select the desired app in the app list.
  4. Click on the End task button or hit the Del key on the keyboard.Task Manager Tab DetailsKill A Process With Task Manager

You are done.

This is Task Manager’s most well known method.

Note: The same can be done from the Details tab. It is a special tab which lists process names instead of app names. There you can select a process in the list and either click on the End process button or hit the Del key. Kill A Process With Task Manager Details Tab

Using the End Task button means Windows first tries to see for a certain timeout if the process has really stopped responding, and attempts to collect a crash or memory dump of the process. It then terminates the app.

Tip: We highly recommend you read the article How to end a process quickly with Task Manager in Windows 10 to learn all Task Manager tricks. Also, you can get the classic Task Manager app in Windows 10 to end processes or tasks.

Another classic method to close a process is the console tool taskill. It comes bundled with modern versions of Windows.

Kill a process using Taskkill

Note: Some processes are running as Administrator (elevated). In order to kill them, you need to open an elevated command prompt instance.

  1. Open the command prompt as the current user or as Administrator.
  2. Type tasklist to see the list of running processes and their PIDs. Since the list might be very long, you can use a pipe character with the more command.
    tasklist | more

    Windows 10 Tasklist

  3. To kill a process by its PID, type the command:
    taskkill /F /PID pid_number
  4. To kill a process by its name, type the command
    taskkill /IM "process name" /F

For example, to kill a process by its PID:

taskkill /F /PID 1242

Windows 10 Taskkill By Pid
To kill a process by its name:

taskkill /IM "notepad.exe" /F

Windows 10 Taskkill By Name
Taskkill supports many useful options which you can use to terminate apps. You can learn them by running it as follows: taskkill /?. Using taskkill, you can close all not responding tasks at once in Windows 10.

Kill a process using PowerShell

Note: To kill a process which runs elevated, you need to open PowerShell as Administrator.

  1. Open PowerShell. If required, run it as Administrator.
  2. Type the command Get-Process to see the list of running processes.
  3. To kill a process by its name, execute the following cmdlet:
    Stop-Process -Name "ProcessName" -Force
  4. To kill a process by its PID, run the command:
    Stop-Process -ID PID -Force

Examples:
This command will close the notepad.exe process.

Stop-Process -Name "Notepad" -Force

Windows 10 Powershell Kill A Process

The next command will close a process with PID 2137.

Stop-Process -ID 2137 -Force

If you need to kill a Store app, see the following article:

How to Terminate Store Apps in Windows 10

That’s it.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won’t take a lot from you, but it will help us grow. Thanks for your support!

Перейти к содержимому

Управлять процессами в Windows можно не только через UI («Менеджер задач»), но и через командную строку. К тому же командная строка предоставляет больше контроля над данными действиями.

Для вывода списка запущенных процессов нужно ввести команду:

tasklist

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
System Idle Process              0 Services                   0          4 K
System                           4 Services                   0      4 124 K
smss.exe                       348 Services                   0        336 K
csrss.exe                      480 Services                   0      2 780 K
wininit.exe                    552 Services                   0        572 K
csrss.exe                      568 Console                    1      9 260 K
winlogon.exe                   616 Console                    1      2 736 K
services.exe                   640 Services                   0      9 284 K
lsass.exe                      660 Services                   0     16 464 K
explorer.exe                 27736 Console                    1    125 660 K

«Убить» процесс можно как по его имени, так и по PID:

>Taskkill /IM explorer.exe /F
>Taskkill /PID 27736 /F

Флаг /F указывает, что завершить процесс нужно принудительно. Без данного флага, в некоторых случаях, процесс может не «убиться» (к примеру, это актуально как раз для процесса explorer.exe).

We use the taskkill command to terminate applications and processes in the Windows command prompt. Running taskkill is the same as using the End task button in the Windows Task Manager.

With taskkill, we kill one or more processes based on the process ID (PID) or name (image name). The syntax of this command is as follows:

taskkill /pid PID
taskkill /im name

You can use the tasklist command to find the PID or image name of a Windows process.

using the tasklist command to find the PID or image name of a process

Using the tasklist command to find the PID of a Process.

The /F option tells Windows to force kill the process:

taskkill /f /im notepad.exe

Kill a Process by PID

In the following example, we run the taskkill command to terminate a process with a PID of 1000:

taskkill /f /pid 3688

The multiple processes can be terminated at once, as shown in the following example:

taskkill /pid 3688 /pid 4248 /pid 4258

Kill a Process by Name

To kill a process by its name, we use the /IM option. In the following example, we run the taskkill command to terminate the notepad.exe process:

taskkill /im notepad.exe

The /t option tells Windows to terminate the specified process and all child processes. In the following example, we force kill Microsoft Edge and its child processes:

taskkill /f /t /im msedge.exe

Command Options

/S Specifies the IP Address or name of the remote system to connect to.
/U Specifies the name of the Windows user under which the command should execute.
/P Password for the user. Prompts for input if omitted.
/FI This option is to apply filters (see examples below).
/PID Specifies the PID of the process to be terminated.
/IM Specifies the image name of the process to be terminated.
/T Terminates the specified process and its child processes (end all tasks).
/F Forcefully kill a process.

Examples

Terminate a process with a PID of 4000:

taskkill /pid 4000

Terminate spoolsv.exe (which is the Print Spooler service on Windows):

taskkill /im spoolsv.exe

Using /f and /t options to forcefully terminate the entire process tree of the Microsoft Edge browser:

taskkill /f /t /im msedge.exe

taskkill command

Force kill any process that starts with the name note:

taskkill /f /t /im note*

In the following example, we terminate all processes that are not responding by using a filter:

taskkill /f /fi "status eq not responding"

In the above example, eq stands for equal. You can use the following filters with the /fi option.

taskkill filters

Taskkill Filters

Run taskkill command on a remote computer:

taskkill /s 192.168.1.100 /u robst /pid 5936

In the above example, the process with PID 5936 will be terminated on a remote computer with an IP address of 192.168.1.100.

Note that the Windows Firewall must be configured on the remote computer to allow the taskkill command. Click the link below for instructions on how to do it.

How to allow tasklist and taskkill commands from Windows Firewall

All right, here’s the end of this tutorial. While working on the CMD, you can run taskkill /? to display the help page, command options, and filters of the tasklist command.

The PowerShell equivalent to the taskkill is the Stop-Process cmdlet. But you can always use taskkill in PowerShell as well.

  • Windows is loading files что это
  • Windows keylogger бесплатно usd49 windows
  • Windows linux mac os что выбрать
  • Windows kill process by name
  • Windows is loading files перевод на русский