Taskkill is a Windows command-line tool used to terminate running processes by Process ID (PID) or image name (executable name). It functions similarly to ending a task in Task Manager but from the command line, offering more automation and scripting capabilities.

Key Syntax and Options

  • taskkill /PID <processid>: Terminates a process using its unique Process ID. Use tasklist to find the PID.

  • taskkill /IM <imagename>: Terminates a process by its image name (e.g., notepad.exe, chrome.exe). Wildcards like * can be used (e.g., taskkill /IM *.exe).

  • /F: Forces the termination of a process, especially useful for unresponsive applications.

  • /T: Terminates the specified process and any child processes started by it (a "tree kill").

  • /FI "filter": Applies filters to select processes (e.g., taskkill /FI "STATUS eq NOT RESPONDING" to kill all frozen apps).

Example Commands

  • Forcefully close Notepad:
    taskkill /IM notepad.exe /F

  • Kill a process by PID (e.g., PID 1234):
    taskkill /PID 1234 /F

  • End all child processes of a parent (e.g., browser tabs):
    taskkill /IM chrome.exe /F /T

  • Close all non-responsive programs:
    taskkill /FI "STATUS eq NOT RESPONDING" /F

Advanced Use

  • Remote termination: Use /S system to target a remote machine (e.g., taskkill /S 192.168.1.100 /U admin /P password /IM notepad.exe).

  • PowerShell equivalent: Use Stop-Process for similar functionality with better object-based scripting.

⚠️ Caution: Forcing process termination may result in unsaved data loss or system instability. Use /F only when necessary.

you must kill child process too if any spawned to kill successfully your process

taskkill /IM "process_name" /T /F

/T = kills child process

/F = forceful termination of your process
Answer from aaa on Stack Overflow
🌐
Wikihow
wikihow.com › computers and electronics › operating systems › windows › 4 ways to use the taskkill command in cmd & powershell
4 Ways to Use the Taskkill Command in CMD & PowerShell
February 19, 2026 - Using the taskkill command to end Windows processesTaskkill is a Windows Command Prompt (cmd) command that ends one or more tasks. It's kind of like ending a task with Task Manager, but from the command line. Taskkill can also do things...
Discussions

CMD what does /im (taskkill)? - Stack Overflow
I just read the following command: taskkill /f /im something.exe I read that /f forces the task to close, but what does /im do? More on stackoverflow.com
🌐 stackoverflow.com
what does taskkill /f /IM explorer.exe do?
taskkill is fairly self explanatory. /f is "forcefully end" and /IM is "/IM imagename Specifies the image name of the process to be terminated" and explorer.exe is your windows explorer menu, which includes a lot of things. If you taskkill explorer.exe, you'd have to restart it (something like run explorer.exe/run new task in task manager) or shut down and start again. People mainly kill and restart task manager if their explorer is acting up, which happens from time to time. More on reddit.com
🌐 r/pcmasterrace
2
0
March 6, 2022
Really killing a process in Windows - Stack Overflow
While I hate that this is the correct answer, there's no doubt in my mind that it is more correct than taskkill below.... stupid buggy drivers! More on stackoverflow.com
🌐 stackoverflow.com
Using Command prompt to kill a task and start a task; machine doesn't recognize?
So, this one has me pretty stumped. I’m pretty sure I’m doing everything right here, which is why I’m stumped, but that’s also why I’m coming to the experts for help! I have a user who wants to have a script autorun at 3am daily, which will kill the current kiosk-style PowerPoint ... More on community.spiceworks.com
🌐 community.spiceworks.com
18
8
October 20, 2021
🌐
SS64
ss64.com › nt › taskkill.html
Taskkill - end one or more processes. - Windows CMD - SS64.com
Syntax TASKKILL [/S system [/U username [/P [password]]]] { [/FI filter] [/PID processid | /IM imagename] } [/F] [/T] Options /S system The remote system to connect to. /U [domain\]user The user context under which the command should execute. /P [password] The password.
🌐
Reddit
reddit.com › r/pcmasterrace › what does taskkill /f /im explorer.exe do?
r/pcmasterrace on Reddit: what does taskkill /f /IM explorer.exe do?
March 6, 2022 - and explorer.exe is your windows explorer menu, which includes a lot of things. If you taskkill explorer.exe, you'd have to restart it (something like run explorer.exe/run new task in task manager) or shut down and start again.
Find elsewhere
🌐
Computer Hope
computerhope.com › taskkill.htm
Taskkill Command
June 1, 2025 - The taskkill command allows a user running any version of Microsoft Windows from XP on to "kill" a task from a Windows command line by PID (Process IDentifier) or image name.
🌐
Dosprompt
dosprompt.info › commands › taskkill.asp
TASKKILL | dosprompt.info
TASKKILL /IM notepad.exe TASKKILL /PID 1230 /PID 1241 /PID 1253 /T TASKKILL /F /IM cmd.exe /T TASKKILL /F /FI "PID ge 1000" /FI "WINDOWTITLE ne untitle*" TASKKILL /F /FI "USERNAME eq NT AUTHORITY\SYSTEM" /IM notepad.exe TASKKILL /S system /U domain\username /FI "USERNAME ne NT*" /IM * TASKKILL /S system /U username /P password /FI "IMAGENAME eq note*"
🌐
IT trip
en.ittrip.xyz › windows › technique
A Complete Guide to the “taskkill” Command in Windows | IT trip
March 5, 2024 - Want to efficiently manage processes in the Windows environment? The “taskkill” command is a powerful tool for terminating processes. This article provides a detailed explanation of how to use the taskkill command, from basics to advanced applications. It’s a useful command when a program becomes unresponsive or when you need to free up system resources.
Top answer
1 of 16
1

Try this: wmic process where “name=‘myprocessname.exe’” delete

If you get an error with that too the see this:

Taskkill command fails with error initialization failure Windows
I have a script that kills a specific task. It has stopped running. When I manually type the command TASKKILL /F /IM “notepad.exe” I get error initialization failure. This script works on all other 2003 and 2008 servers. I am not actually trying to kill notepad that is just an example. It won’t work if typed in manually.
2 of 16
8

So, this one has me pretty stumped. I’m pretty sure I’m doing everything right here, which is why I’m stumped, but that’s also why I’m coming to the experts for help!

I have a user who wants to have a script autorun at 3am daily, which will kill the current kiosk-style PowerPoint that is running, and then re-open the file with Powerpoint - doing this because the file has been updated in the meantime, so it will open a new file for the next day.

The machine running the kiosk display is a woefully outdated windows Vista Machine. Not sure if that will affect cmd syntax of commands.

Anyway, here is my current script in a *.bat file:

@echo off

taskkill /IM PPTVIEW.exe /t /f
start PPTVIEW.exe “S:[File-Path]\Run Daily.ppsx”

And that’s it. everything I know about *.bat files says that this should work just fine. And it does, on my personal Windows 10 machine in the office. But it doesn’t run on the Windows Vista; it gives the “invalid namespace” error in cmd, and also a dialog box that says “Windows cannot find PPTVIEW.exe”.

I double checked that the task was running in task manager and that I had the right name, and I do. Furthermore, I was able to use Powershell to “Stop-Process -Name PPTVIEW -Force”, without issue.

I’ve tried giving cmd the exact file-path of PPTVIEW in the start command as well, but it still claimed it couldn’t find it. So the problem is somewhat two-fold; the machine can’t find the process to terminate it, and also cannot find the process to start it again.

🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 2817004 › dos-command-taskkill-f-pid-result-s-show-not-found
Dos command “taskkill /f /pid” result’s show Not found - Microsoft Q&A
June 9, 2018 - I have a win7 sp1 x64 system When I run the command taskkill /f /pid 4987(a notepad’s pid) Then the result’s show me Not found Can you help me? Thinks!
Top answer
1 of 2
1

Harm to the hardware by taskkill seem very improbable to me.

Harm to Windows is only possible if you use it to kill a Windows component that works in cooperation with other components, but you need to be really unlucky. Normally, killing a Windows component will only cause the tasks that it does to become unavailable. Killing a vital process will usually cause Windows to immediately reboot.

There is a big difference when using the /f switch or not. Using the switch will cause the immediate termination of the process (unless it's stuck in a kernel call that can't be terminated forcefully).

Without /f, taskkill will politely send the task a message that it needs to terminate, same as clicking the X on the title bar. Normally this should be tried first, since the task will then shutdown in an orderly manner and without data loss. Only if this fails should /f be used.

2 of 2
0

Both taskkill (WM_CLOSE signal) and Alt + F4, also any other ways to interrupt and close processes can cause harm either to your software or system.

It all depends on how the closed process handles interruption. One app could handle Alt + F4 not fully properly and e.g. result in its config not saved correctly. I'd say that's rare nowadays with all the frameworks in use and what not, but it happened to me in the past, e.g. with the example you also provided - a game starting to save right after I pressed Alt + F4, which I guess it registered after the fact. Save file got corrupted.

And of course taskkill /f (TerminateProcess) can cause more harm than the other alternatives as it skips some implemented security measures. Especially low level, e.g. system-related, processes could cause a lot of issues when forced to close.

I don't think this question is answerable in a general manner. I would just advise not to use taskkill in scripts unless you're sure it's safe - e.g. it can't damage any data or anything alike. Regular CLI/GUI apps that don't do I/O operations are the safest. Anything else - you might expect problems.

TLDR summary: it depends on the application/process, you should ensure nothing can go wrong, but it's likely to be safe most of the time nowadays.

🌐
Medium
medium.com › @sealsec2022 › tasklist-and-taskkill-for-windows-command-line-d00b822b22b4
Mastering Windows Command Line: Tasklist and Taskkill | by Transcending Mythology | Medium
May 3, 2023 - Taskkill is a command that allows you to terminate a running process. If a program is unresponsive or causing issues on your computer, you can use Taskkill to force it to close. To use Taskkill, you need to know the process ID of the program ...
🌐
Spiceworks
community.spiceworks.com › software & applications
Taskkill - Software & Applications - Spiceworks Community
February 15, 2016 - In my staging room, there’s adequate space for up to 25 computers to be imaging at once. Once the imaging process completes, I have to log in to each individual machine using the standard CTRL+ALT+DEL process. I log in to all machines using the same account.
🌐
Npm
npm.io › search › keyword:taskkill
Taskkill | npm.io
taskkilltaskkillterminatewindowswinwin32pididprocess5.0.0 • Published 4 years ago