Skip to main content

Command referencetaskkill

taskkill command (Windows / CMD)

WindowsCMDprocessbeginner

What it does

End processes by process ID or executable image name. Searches for the taskkill command cmd usually need CMD syntax, practical switches, and notes on how it compares with PowerShell or Linux alternatives. This page covers syntax, common options, and copyable examples for Command Prompt.

End processes by process ID or executable image name.

Syntax

taskkill [/S system] [/PID processid | /IM imagename] [/T] [/F]

Common options

Flag / optionMeaning
/PID idTarget a process by ID.
/IM nameTarget processes by image name.
/TAlso end child processes.
/FForce termination.
/FI filterSelect tasks using a filter.

Practical examples

End by PID

taskkill /PID 4242

Requests termination of one process.

End image

taskkill /IM notepad.exe

Ends Notepad instances.

Force process tree

taskkill /PID 4242 /T /F

Forcibly terminates the process and children.

Linux ↔ Windows equivalent

Closest match: kill (Linux / bash / sh / zsh). Send a signal to one or more processes.

Common mistakes

  • Using `/F` before allowing an application to save or clean up.
  • Killing every process with a shared image name unintentionally.

FAQ

What does taskkill do in Command Prompt?

End processes by process ID or executable image name.

How do I run taskkill in CMD?

Open Command Prompt and follow `taskkill [/S system] [/PID processid | /IM imagename] [/T] [/F]`; quote paths containing spaces.

What is a practical taskkill example in CMD?

Try `taskkill /PID 4242` — Requests termination of one process.

Can taskkill be used in a batch file?

Yes. Check its exit code and escape CMD metacharacters when input is variable.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.