How to list and end processes

Overview

tasklist shows running processes and their process IDs (PIDs). taskkill requests that a selected process stop.

Warning: ending a process can lose unsaved work or destabilize Windows. Prefer closing the app normally and target only processes you recognize.

  • Start Notepad as a disposable process when practicing.
  • PIDs can change each time a program starts.
  • Without /f, TASKKILL first attempts an ordinary termination.

Commands to try

Type each command at the prompt, then press Enter. Replace sample names and paths with ones that exist on your computer.

Commands are generally not case-sensitive, but preserving the spelling shown here makes scripts easier to read.

tasklist
tasklist /fi "imagename eq notepad.exe"
tasklist /fi "pid eq 1234"
taskkill /pid 1234
taskkill /im notepad.exe

Useful options and details

Options change how a command behaves. Add spaces exactly as shown, and use the command's built-in help when an option is unfamiliar.

A path containing spaces must be enclosed in double quotes, such as "C:\My Files".

  • /fi applies a filter such as image name, PID, or status.
  • /pid targets one PID; /im targets an executable image name.
  • /t includes child processes and /f forces termination; both increase risk.

Tips and common mistakes

Check the current folder and read the command output before assuming an operation succeeded.

Practice with disposable files first. Commands that delete, overwrite, or stop a process may not offer an Undo button.

  • Never copy an old PID from a guide; it may identify a different process on your computer.
  • Avoid critical processes such as csrss.exe, wininit.exe, and security software.
  • Access denied can indicate a protected or higher-privilege process; do not bypass it casually.

Safe practice

Create a temporary practice folder under your user profile so the examples cannot affect Windows system files.

After each command, inspect the result with dir or another read-only command before continuing.

  • Open an unsaved-empty Notepad window.
  • Find its PID with a TASKLIST filter.
  • Close it normally; repeat and use non-forced TASKKILL only if desired.