taskkill - Terminate Processes

Maintained on

When an application freezes and stops responding, Task Manager is the usual way to close it. You can also end processes from the command prompt with the taskkill command.

It is especially useful when you automate tasks in batch files or want to close several processes at once.

If you just want to close a frozen app, run taskkill /F /IM appname.exe. You can look up the executable name with the tasklist command.

taskkill syntax

TASKKILL [options]

Main options

OptionDescription
/IM process_nameTerminate by process (image) name
/PID process_idTerminate by process ID
/FForce termination
/TAlso terminate child processes
/FI "filter"Target processes that match a filter

Terminate by process name (/IM)

Specify the executable name to end a process.

taskkill /IM notepad.exe
- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>taskkill /IM notepad.exe
SUCCESS: Sent termination signal to the process “notepad.exe” with PID 12345.
C:\users\user>

If several processes share the same name, all of them are targeted. /IM also accepts the wildcard *.

taskkill /F /IM chrome*

Force termination (/F)

If the normal termination signal does not close the process, use /F to force it.

taskkill /F /IM notepad.exe
- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>taskkill /F /IM notepad.exe
SUCCESS: The process “notepad.exe” with PID 12345 has been terminated.
C:\users\user>
おすすめ書籍※ 広告を含む場合があります
中小企業経営者のためのRPA入門 RPA導入を成功させる方法

中小企業経営者のためのRPA入門 RPA導入を成功させる方法

60分でわかる! AIエージェント 超入門

60分でわかる! AIエージェント 超入門

コマンドラインの黒い画面が怖いんです。

コマンドラインの黒い画面が怖いんです。

知識・才能ゼロでもらく~に月10万円稼ぐ! よくわかるAI副業超入門

知識・才能ゼロでもらく~に月10万円稼ぐ! よくわかるAI副業超入門

Normal vs. forced termination

Without /F, a close request (WM_CLOSE) is sent to the process, and the application may show a dialog such as “Do you want to save?”. With /F, the process ends immediately without any dialog, so unsaved data is lost.

Terminate by process ID (/PID)

You can also use the process ID (PID) that you found with the tasklist command.

taskkill /PID 12345

Terminate several processes at once

taskkill /PID 12345 /PID 67890

To end only one of several processes with the same name, look up its PID with tasklist and pass it to /PID.

Terminate child processes too (/T)

The /T option ends the specified process together with its child processes.

taskkill /F /T /IM cmd.exe
Be careful with /T

Because /T also ends child processes, unintended processes may be terminated. When you target cmd.exe, take care not to close your own command prompt.

Use filters (/FI)

The /FI option limits the target to processes that match a condition.

Main filter conditions

FilterOperatorsDescription
STATUSeq, neProcess status
IMAGENAMEeq, neProcess name
PIDeq, ne, gt, lt, ge, leProcess ID
MEMUSAGEeq, ne, gt, lt, ge, leMemory usage (KB)
USERNAMEeq, neUser running the process
WINDOWTITLEeq, neWindow title

Terminate unresponsive processes

taskkill /F /FI "STATUS eq NOT RESPONDING"
- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>taskkill /F /FI "STATUS eq NOT RESPONDING"
SUCCESS: The process “app.exe” with PID 9876 has been terminated.
C:\users\user>
チェック

This targets only “not responding” processes, which is handy for closing frozen applications in bulk. The condition mainly works for applications with a window and may have no effect on background processes.

Terminate by window title

The WINDOWTITLE filter narrows the target by window title. Wildcards are supported.

taskkill /F /FI "WINDOWTITLE eq *Notepad*"

Find processes that use a lot of memory

tasklist /FI "MEMUSAGE gt 500000"

After checking, you can end the processes you need to. taskkill accepts the same /FI filters.

When a process will not close

”Access is denied”

To end another user’s process or a system-managed process, run the command prompt as administrator. Protected processes (such as security software) cannot be stopped with taskkill even then.

”The process was not found”

The process name is misspelled or the process has already ended. Check the correct image name with tasklist.

Check the result with the exit code

taskkill returns exit code 0 on success and 128 when the target process was not found, so a batch file can branch on ERRORLEVEL.

taskkill /F /IM notepad.exe >nul 2>&1
IF %ERRORLEVEL% EQU 0 (
    echo Terminated.
) ELSE IF %ERRORLEVEL% EQU 128 (
    echo The process was not found.
) ELSE (
    echo Could not terminate it. Administrator rights may be required.
)

Terminate processes on a remote computer

Use /S for the computer name, /U for the user name and /P for the password to end processes on another PC on the network (permissions and firewall settings are required). Some filters, such as /FI "STATUS ...", cannot be used with remote processes.

taskkill /S PC-SERVER01 /U username /IM notepad.exe /F

Practical examples

Close several applications at once

@echo off
echo Closing browsers...
taskkill /F /IM chrome.exe >nul 2>&1
taskkill /F /IM msedge.exe >nul 2>&1
taskkill /F /IM firefox.exe >nul 2>&1
echo Done.

Safely end a process in a batch file

@echo off
setlocal

set TARGET=notepad.exe

tasklist /FI "IMAGENAME eq %TARGET%" | findstr /I "%TARGET%" >nul
IF %ERRORLEVEL% EQU 0 (
    echo Closing %TARGET%.
    taskkill /IM %TARGET%
) ELSE (
    echo %TARGET% is not running.
)

endlocal

Using TASKLIST and TASKKILL together

The usual flow is to check a process with tasklist and then end it with taskkill.

tasklist /FI "IMAGENAME eq notepad.exe"
taskkill /IM notepad.exe

Summary

TaskCommand
End by process nametaskkill /IM name
Force terminationtaskkill /F /IM name
End by PIDtaskkill /PID id
End including child processestaskkill /F /T /IM name
End unresponsive processestaskkill /F /FI "STATUS eq NOT RESPONDING"
End a process on a remote PCtaskkill /S PC /U user /IM name /F

Practice question

Practice Problem

Which command correctly force-closes only unresponsive (frozen) processes?

回答がサーバーに送信されることはありません
#Command Prompt #Batch Files #Command Line #Commands