taskkillTASKKILL Command – Terminate Processes in Windows CMD
Learn how to use the TASKKILL command to terminate processes by PID or name, force kill unresponsive applications, and manage processes remotely in Windows. Complete guide with syntax, examples, and tips.
The TASKKILL command is a Windows Command Prompt utility that terminates one or more processes by process ID (PID) or image name, with options to force termination of unresponsive applications and end processes on remote computers. Use TASKKILL to close hung programs, stop resource-hogging processes, terminate services, automate process management in scripts, or force quit applications that won't close normally—essential for system troubleshooting, resource management, and administrative automation.
Whether you're a system administrator remotely terminating frozen services and cleaning up orphaned processes, a developer stopping test applications during debugging and automation, or a power user force-closing unresponsive programs that Task Manager can't end, TASKKILL provides precise command-line control over process termination. IT professionals rely on TASKKILL for automated cleanup scripts, security incident response, and process lifecycle management across enterprise environments.
This comprehensive guide covers TASKKILL syntax, all parameters and termination options, practical examples for killing processes safely and forcefully, troubleshooting tips for access denied errors, related process management commands, and frequently asked questions. By the end, you'll confidently use TASKKILL for process termination, resource cleanup, and automated process management in Windows environments.
What Is the TASKKILL Command?
The TASKKILL command is a powerful process termination tool in Windows Command Prompt that sends termination signals to processes, allowing graceful shutdown or forced termination depending on parameters used.
TASKKILL works in Command Prompt (CMD), Windows PowerShell (with CMD compatibility), Windows Terminal, and is available in Windows XP through Windows 11, Windows Server 2003 through Windows Server 2022, and all enterprise editions. Its filtering and remote capabilities make it superior to Task Manager for scripting and automation scenarios.
The command supports two termination methods: graceful termination (allows processes to clean up resources) and forced termination with /F (immediately kills processes without cleanup). System administrators use TASKKILL in maintenance scripts to stop services, cleanup scripts to remove orphaned processes, monitoring scripts to restart hung applications, and security scripts to terminate malicious or unauthorized processes.
TASKKILL vs Task Manager End Task
While Task Manager provides a GUI for ending tasks, TASKKILL offers:
- Command-line automation – Scriptable process termination in batch files and PowerShell
- Precise targeting – Terminate by exact PID or filter by multiple criteria
- Force termination – More reliable forced killing with
/Fparameter - Remote computer access – Terminate processes on network computers without RDP
Most automated maintenance and cleanup scripts use TASKKILL for its reliability and remote management capabilities.
Syntax
TASKKILL [/S system [/U username [/P [password]]]]
{ [/FI filter] [/PID processid | /IM imagename] } [/T] [/F]
Parameters
| Parameter | Description |
|---|---|
/S system | Specifies the remote system to connect to |
/U [domain\]user | Specifies the user context under which to execute |
/P [password] | Specifies the password for the given user context |
/FI filter | Applies a filter to select a set of tasks (same filters as TASKLIST) |
/PID processid | Specifies the PID (Process ID) of the process to be terminated |
/IM imagename | Specifies the image name of the process to be terminated (wildcards allowed) |
/T | Terminates the specified process and any child processes started by it |
/F | Forces termination of the process (does not allow cleanup) |
Required: Must specify either /PID or /IM to identify target processes.
Wildcard support: /IM accepts wildcards (*) to match multiple processes: TASKKILL /IM note*.exe /F.
How to Use TASKKILL Command
Terminate Process by Image Name
Kill all processes matching an executable name:
TASKKILL /IM notepad.exe
TASKKILL /IM chrome.exe
TASKKILL /IM explorer.exe
Terminates all instances of the specified application. Use exact executable name including .exe extension.
Force Terminate Process
Force kill a process immediately without allowing cleanup:
TASKKILL /F /IM notepad.exe
TASKKILL /F /IM firefox.exe
TASKKILL /F /IM javaw.exe
The /F parameter forces immediate termination. Use when processes don't respond to normal termination signals or when cleanup isn't needed.
Terminate Process by PID
Kill a specific process using its process ID:
TASKKILL /PID 1234
TASKKILL /PID 5678
TASKKILL /F /PID 9012
Use TASKLIST to find the PID first, then terminate by exact PID. More precise than image name when multiple instances of an application are running.
Terminate Multiple Processes by PID
Kill several processes in a single command:
TASKKILL /PID 1234 /PID 5678 /PID 9012
TASKKILL /F /PID 1000 /PID 2000 /PID 3000
Separate multiple PIDs with individual /PID parameters. Efficient for batch termination during cleanup operations.
Terminate All Instances of an Application
Kill every running instance of a program:
TASKKILL /IM chrome.exe /F
TASKKILL /IM WINWORD.EXE /F
TASKKILL /IM iexplore.exe /F
Terminates all matching processes. Use /F to ensure termination of all instances, including background processes.
Terminate Process and Child Processes
Kill a process and all processes it created:
TASKKILL /PID 1234 /T
TASKKILL /IM cmd.exe /T /F
TASKKILL /IM python.exe /T /F
The /T parameter terminates the process tree. Essential when stopping parent processes that spawn child processes (like scripts, compilers, or automation tools).
Terminate Using Wildcards
Kill multiple applications matching a pattern:
TASKKILL /IM note*.exe /F
TASKKILL /IM chrome*.exe /F
TASKKILL /IM java*.exe /F
Wildcards (*) match any characters. Useful for terminating related processes or multiple versions of an application.
Terminate Processes with Filters
Use filters to selectively terminate processes:
TASKKILL /FI "STATUS eq NOT RESPONDING" /F
TASKKILL /FI "MEMUSAGE gt 500000" /F
TASKKILL /FI "USERNAME eq DOMAIN\user" /F
Combines filtering (like TASKLIST) with termination. Powerful for automated cleanup based on process state, resource usage, or user context.
Terminate Process on Remote Computer
Kill processes on a network computer:
TASKKILL /S remotecomputer /U admin /P password /IM notepad.exe /F
TASKKILL /S 192.168.1.100 /U domain\admin /IM malware.exe /F
Requires administrative credentials on remote system. Use for remote management, security incident response, or centralized process control.
Terminate with Combined Filters
Apply multiple criteria to target specific processes:
TASKKILL /FI "IMAGENAME eq chrome.exe" /FI "MEMUSAGE gt 500000" /F
TASKKILL /FI "STATUS eq NOT RESPONDING" /FI "USERNAME eq %USERNAME%" /F
Each filter narrows the target set with AND logic. Ensures only processes meeting all criteria are terminated.
Graceful vs Forced Termination
Attempt graceful shutdown first, force if needed:
TASKKILL /IM application.exe
timeout /t 5
TASKKILL /F /IM application.exe
Graceful termination (without /F) allows the process to handle shutdown signals, save data, and release resources. If it doesn't terminate, use /F to force kill.
Terminate System Processes
Kill protected system processes (requires Administrator):
TASKKILL /F /IM explorer.exe
TASKKILL /F /IM dwm.exe
Run Command Prompt as Administrator to terminate system processes. Use extreme caution—terminating critical system processes can cause system instability.
Kill Processes in Batch Scripts
Automate process termination in batch files:
@ECHO OFF
ECHO Terminating processes...
TASKKILL /IM chrome.exe /F 2>NUL
TASKKILL /IM firefox.exe /F 2>NUL
TASKKILL /IM notepad.exe /F 2>NUL
ECHO Process cleanup complete
Use 2>NUL to suppress error messages when processes don't exist. Common in maintenance scripts and automated cleanup routines.
Common Use Cases
-
Force close frozen applications – Use
TASKKILL /F /IM app.exeto terminate unresponsive programs that won't close normally or respond to Alt+F4. -
Kill memory-hogging processes – Use
TASKKILL /FI "MEMUSAGE gt 500000" /Fto terminate processes consuming excessive memory during performance issues. -
Restart Windows Explorer – Use
TASKKILL /F /IM explorer.exethenSTART explorer.exeto restart Explorer when it becomes unresponsive. -
Stop multiple browser instances – Use
TASKKILL /IM chrome.exe /Fto close all Chrome windows and tabs at once during troubleshooting. -
Terminate hung services – Use
TASKKILL /F /PID servicepid /Tto stop services that won't respond to SC or NET STOP commands. -
Kill orphaned processes – Use
TASKKILL /FI "STATUS eq NOT RESPONDING" /Fto clean up hung processes left behind by crashed applications. -
Remote process termination – Use
TASKKILL /S remotepc /U admin /IM malware.exe /Fto stop malicious processes on network computers. -
End task for specific user – Use
TASKKILL /FI "USERNAME eq DOMAIN\user" /IM app.exe /Fto terminate processes for a specific user account. -
Force close application before updates – Use TASKKILL in deployment scripts to ensure applications are closed before installing updates or patches.
-
Kill process tree – Use
TASKKILL /PID parent_pid /T /Fto terminate parent process and all child processes, scripts, or spawned applications. -
Clean up test processes – Use TASKKILL in automated testing scripts to terminate test applications between test runs for clean test environments.
-
Security incident response – Use
TASKKILL /F /IM suspicious.exe /Tto immediately terminate malware or unauthorized processes during security incidents.
Tips and Best Practices
-
Always use /F for frozen processes – Unresponsive applications require force termination:
TASKKILL /F /IM app.exe(graceful termination won't work). -
Verify PID before terminating – Use
TASKLIST /FI "IMAGENAME eq app.exe"to confirm PID before killing to avoid terminating wrong processes. -
Use /T to kill process trees – When terminating parent processes (scripts, compilers), include
/Tto kill all child processes:TASKKILL /PID 1234 /T /F. -
Run as Administrator for system processes – Elevate Command Prompt to terminate protected processes like explorer.exe, dwm.exe, or system services.
-
Suppress errors in scripts – Use
TASKKILL /IM app.exe /F 2>NULto redirect error messages when processes might not exist. -
Restart Explorer after killing it – Always follow
TASKKILL /F /IM explorer.exewithSTART explorer.exeto restore the desktop and taskbar. -
Use wildcards for related processes – Terminate multiple related applications:
TASKKILL /IM java*.exe /Fkills all Java processes. -
Filter by status to kill hung processes – Use
TASKKILL /FI "STATUS eq NOT RESPONDING" /Fto clean up only frozen applications. -
Check ERRORLEVEL in scripts – Verify termination success:
IF ERRORLEVEL 1 ECHO Process termination failed. -
Avoid killing critical system processes – Never terminate csrss.exe, smss.exe, or lsass.exe—doing so will crash the system and require reboot.
-
Use graceful termination first – Try
TASKKILL /IM app.exewithout/Ffirst to allow proper shutdown and data saving before forcing. -
Document process termination in logs – Add
ECHO Terminated process: app.exe >> cleanup.login maintenance scripts for audit trails.
Troubleshooting Common Issues
Access Denied When Terminating Process
Problem: TASKKILL /PID 1234 returns "ERROR: Access is denied."
Cause: Insufficient permissions to terminate the process, especially system processes or processes owned by other users.
Solution: Run Command Prompt as Administrator:
- Right-click Command Prompt
- Select "Run as administrator"
- Run
TASKKILL /F /PID 1234
For other users' processes, use appropriate credentials:
TASKKILL /S localhost /U domain\admin /P password /PID 1234 /F
Prevention: Always run elevated Command Prompt for system administration tasks; verify process ownership with TASKLIST /V.
Process Does Not Terminate with /F
Problem: TASKKILL /F /IM app.exe reports success but process continues running.
Cause: Process is protected by anti-termination mechanisms, rootkit, or driver-level protection.
Solution: Try terminating process tree:
TASKKILL /F /IM app.exe /T
If persistent, use Process Explorer (Sysinternals) to force termination, or reboot into Safe Mode to terminate protected processes.
Prevention: Some legitimate applications (antivirus, system tools) and malware use process protection; use specialized tools for protected process termination.
Invalid Argument or Option Error
Problem: TASKKILL /IM notepad returns "ERROR: Invalid argument/option."
Cause: Missing .exe extension or incorrect parameter syntax.
Solution: Always include full executable name with extension:
TASKKILL /IM notepad.exe /F
Verify syntax uses /IM for image name and /PID for process ID.
Prevention: Use complete executable names including .exe extension; check syntax with TASKKILL /? if uncertain.
No Tasks Running Which Match Specified Criteria
Problem: TASKKILL returns "ERROR: The process 'app.exe' not found."
Cause: Process doesn't exist or image name is incorrect.
Solution: Verify process is running with TASKLIST:
TASKLIST | FINDSTR /I "app"
Use exact name from TASKLIST output:
TASKKILL /IM ActualApp.exe /F
Prevention: Always check process existence and exact name with TASKLIST before attempting termination.
Cannot Terminate Process on Remote Computer
Problem: TASKKILL /S remotepc /IM app.exe /F returns RPC server unavailable or access denied.
Cause: Firewall blocking, insufficient permissions, or Remote Registry service not running.
Solution:
- Use administrative credentials:
TASKKILL /S remotepc /U domain\admin /P password /IM app.exe /F - Verify Remote Registry service is running on remote computer
- Check firewall allows RPC (TCP 135) and dynamic RPC ports
- Test connectivity:
PING remotepc
Prevention: Configure firewall rules for remote management; use domain administrator credentials; ensure Remote Registry service is set to automatic.
Process Terminates But Immediately Restarts
Problem: Application terminates successfully but restarts immediately after TASKKILL.
Cause: Process is managed by Windows Service, Task Scheduler, or parent monitoring process.
Solution: Stop the controlling service or scheduled task:
SC stop ServiceName
SCHTASKS /END /TN "TaskName"
TASKKILL /F /IM app.exe
Or terminate parent process with /T:
TASKKILL /F /PID parent_pid /T
Prevention: Identify whether process is service-managed (use TASKLIST /SVC) or has parent process (use Process Explorer) before terminating.
Related Commands
TASKLIST – View Running Processes
TASKLIST displays all running processes with PID, memory usage, and other details. Always use before TASKKILL to identify targets.
Example:
TASKLIST | FINDSTR /I "chrome"
TASKKILL /F /IM chrome.exe
Integration: TASKLIST identifies processes to terminate, TASKKILL terminates them—essential workflow for safe process management.
WMIC PROCESS – Advanced Process Management
WMIC PROCESS provides detailed process information and termination capabilities using WMI queries.
Example:
WMIC PROCESS WHERE "name='notepad.exe'" DELETE
WMIC PROCESS WHERE "ProcessId=1234" CALL TERMINATE
When to use: Use WMIC for complex queries, conditional termination, or when TASKKILL doesn't provide enough flexibility.
SC – Service Control
SC stops Windows services. Use instead of TASKKILL for service processes to ensure clean service shutdown.
Example:
SC stop wuauserv
SC query wuauserv
Difference: SC stops services properly (triggers service shutdown routines), TASKKILL forcefully kills service processes without proper cleanup.
NET STOP – Stop Services
NET STOP stops Windows services by service name (not image name). Preferred over TASKKILL for services.
Example:
NET STOP "Windows Update"
When to use: Always use NET STOP or SC for service termination; use TASKKILL only when services won't respond to stop commands.
PSKILL – Sysinternals Process Killer
PSKILL (Sysinternals) provides additional process termination capabilities including by-username and wait options.
Example:
PSKILL -t explorer.exe
PSKILL 1234
Integration: PSKILL offers features like process tree termination and can sometimes terminate processes that TASKKILL can't.
SHUTDOWN – System Shutdown
SHUTDOWN can close applications before system shutdown. Use TASKKILL in scripts to ensure clean process termination before SHUTDOWN.
Example:
TASKKILL /F /IM app1.exe
TASKKILL /F /IM app2.exe
SHUTDOWN /s /t 30
When to use: Combine TASKKILL with SHUTDOWN in maintenance scripts to close applications before system restart or shutdown.
Frequently Asked Questions
What does TASKKILL command do?
TASKKILL terminates one or more running processes by process ID (PID) or executable image name. Use TASKKILL to close frozen applications, stop resource-hogging processes, force terminate unresponsive programs with /F, end tasks on remote computers, or automate process cleanup in scripts. More reliable than Task Manager's "End Task" for stubborn processes.
How do I force kill a process in CMD?
Use TASKKILL /F /IM processname.exe to force terminate by name, or TASKKILL /F /PID processid to force kill by PID. The /F parameter forces immediate termination without allowing cleanup. Example: TASKKILL /F /IM notepad.exe force closes all Notepad instances. Run as Administrator for system processes.
What is the difference between TASKKILL and TASKKILL /F?
TASKKILL without /F sends graceful termination signal (allows process to clean up, save data, and exit normally). TASKKILL /F forces immediate termination without cleanup (kills process instantly, no data saving). Use /F for frozen processes that won't respond to normal termination. Example: TASKKILL /IM app.exe (graceful) vs TASKKILL /F /IM app.exe (forced).
How do I kill a process by PID?
Use TASKKILL /PID processid for graceful termination or TASKKILL /F /PID processid to force kill. First, find PID with TASKLIST: TASKLIST /FI "IMAGENAME eq chrome.exe", then terminate: TASKKILL /F /PID 5268. Example: TASKKILL /F /PID 1234 immediately kills process with PID 1234.
Can TASKKILL terminate multiple processes at once?
Yes, specify multiple PIDs or use image name with wildcards. Examples: TASKKILL /PID 1000 /PID 2000 /PID 3000 /F terminates multiple PIDs, TASKKILL /IM chrome.exe /F kills all Chrome instances, TASKKILL /IM java*.exe /F terminates all processes matching pattern. Or use filters: TASKKILL /FI "IMAGENAME eq chrome.exe" /F.
Why does TASKKILL say "Access Denied"?
"Access Denied" occurs when you lack permissions to terminate the target process. Run Command Prompt as Administrator for system processes or processes owned by other users. Right-click Command Prompt → "Run as administrator", then run TASKKILL /F /PID processid. For other users' processes on same computer, use elevated privileges; for remote computers, use administrator credentials with /U and /P.
How do I use TASKKILL on a remote computer?
Use /S for remote system, /U for username, /P for password: TASKKILL /S remotecomputer /U domain\admin /P password /IM notepad.exe /F. Example: TASKKILL /S 192.168.1.100 /U administrator /P /IM malware.exe /F. Requires administrative rights on remote computer and Remote Registry service running. Firewall must allow RPC traffic (TCP 135).
What does TASKKILL /T do?
/T terminates the process and all child processes it created (process tree termination). Example: TASKKILL /IM cmd.exe /T /F kills CMD and all processes launched from it. Essential for stopping scripts, batch files, or applications that spawn multiple processes. Without /T, only the parent process terminates, leaving orphaned child processes running.
How do I kill a process that won't die?
Try escalating force: 1) TASKKILL /IM app.exe, 2) TASKKILL /F /IM app.exe, 3) TASKKILL /F /IM app.exe /T, 4) Run as Administrator and retry. If still running, use Process Explorer (Sysinternals) to kill, or restart in Safe Mode. Protected processes (rootkits, some antivirus) may require specialized removal tools or system restart.
Can I use wildcards with TASKKILL?
Yes, /IM supports wildcards (*) to match multiple processes: TASKKILL /IM note*.exe /F kills notepad.exe, notepad++.exe, etc. Example: TASKKILL /IM chrome*.exe /F terminates all Chrome-related executables. Wildcards only work with /IM (image name), not /PID. Use carefully—wildcards may match unintended processes.
How do I restart Windows Explorer with TASKKILL?
Terminate Explorer: TASKKILL /F /IM explorer.exe, then restart it: START explorer.exe. Full command sequence: TASKKILL /F /IM explorer.exe && START explorer.exe. This fixes frozen taskbar, unresponsive desktop, or Explorer glitches. The desktop will disappear briefly then reappear. Run as Administrator if access denied.
What processes should I never terminate with TASKKILL?
Never kill critical system processes: csrss.exe (Client Server Runtime), smss.exe (Session Manager), lsass.exe (Local Security Authority), wininit.exe (Windows Initialization), or services.exe (Service Control Manager). Terminating these causes immediate system crash (BSOD) and requires reboot. Safe to terminate: explorer.exe (can restart), user applications, and most svchost.exe instances.
Quick Reference Card
| Command | Purpose | Example Use Case |
|---|---|---|
TASKKILL /IM app.exe | Graceful terminate | Normal application close |
TASKKILL /F /IM app.exe | Force terminate | Kill frozen application |
TASKKILL /PID 1234 | Kill by PID | Terminate specific process |
TASKKILL /PID 1 /PID 2 /PID 3 | Kill multiple PIDs | Batch termination |
TASKKILL /IM app.exe /T /F | Kill process tree | Stop parent and children |
TASKKILL /IM note*.exe /F | Wildcard terminate | Kill matching processes |
TASKKILL /FI "STATUS eq NOT RESPONDING" /F | Kill hung processes | Clean up frozen apps |
TASKKILL /S remote /U admin /IM app.exe /F | Remote terminate | Kill on network computer |
TASKKILL /F /IM explorer.exe | Restart Explorer | Fix frozen desktop |
Try TASKKILL Command Now
Ready to practice process termination and management? Use our Windows Command Simulator to run TASKKILL commands safely in your browser. No installation required—practice TASKKILL, force termination, PID-based killing, and process tree management in a risk-free environment. Perfect for learning, training, or testing command sequences before running them on production systems.
Explore the full Commands Reference for more Windows CMD utilities, including process management (TASKLIST, WMIC, SC), system tools (SHUTDOWN, SYSTEMINFO), and resource monitoring commands.
Summary
The TASKKILL command is the essential Windows tool for terminating processes from the command line. Use TASKKILL to end tasks by image name with /IM, terminate by process ID with /PID, force kill unresponsive programs with /F, terminate process trees with /T, filter target processes with /FI, and manage processes on remote computers with /S.
Start with graceful termination (TASKKILL /IM app.exe), escalate to forced termination for frozen processes (TASKKILL /F /IM app.exe), use /T to kill parent and child processes together, and combine with TASKLIST to verify targets before terminating. Master TASKKILL for process cleanup, performance troubleshooting, automated maintenance, and security incident response in Windows environments.
Understanding TASKKILL is fundamental to Windows system administration and process management. The command's forced termination capabilities, process tree handling, and remote management support make it indispensable for IT professionals managing servers, troubleshooting frozen applications, cleaning up orphaned processes, and building automated maintenance scripts across enterprise Windows infrastructure.