Really killing a process in Windows

Windows

Windows Problem Overview


Occasionally a program on a Windows machine goes crazy and just hangs. So I'll call up the task manager and hit the "End Process" button for it. However, this doesn't always work; if I try it enough times then it'll usually die eventually, but I'd really like to be able to just kill it immediately. On Linux I could just kill -9 to guarantee that a process will die.

This also could be used for writing batch scripts and writing batch scripts is programming.

Is there some program or command that comes with Windows that will always kill a process? A free third-party app would be fine, although I'd prefer to be able to do this on machines I sit down at for the first time.

Windows Solutions


Solution 1 - Windows

"End Process" on the Processes-Tab calls TerminateProcess which is the most ultimate way Windows knows to kill a process.

If it doesn't go away, it's currently locked waiting on some kernel resource (probably a buggy driver) and there is nothing (short of a reboot) you could do to make the process go away.

Have a look at this blog-entry from wayback when: http://blogs.technet.com/markrussinovich/archive/2005/08/17/unkillable-processes.aspx

Unix based systems like Linux also have that problem where processes could survive a kill -9 if they are in what's known as "Uninterruptible sleep" (shown by top and ps as state D) at which point the processes sleep so well that they can't process incoming signals (which is what kill does - sending signals).

Normally, Uninterruptible sleep should not last long, but as under Windows, broken drivers or broken userpace programs (vfork without exec) can end up sleeping in D forever.

Solution 2 - Windows

taskkill /im myprocess.exe /f

The "/f" is for "force". If you know the PID, then you can specify that, as in:

taskkill /pid 1234 /f

Lots of other options are possible, just type taskkill /? for all of them. The "/t" option kills a process and any child processes; that may be useful to you.

Solution 3 - Windows

Process Hacker has numerous ways of killing a process.

(Right-click the process, then go to Miscellaneous->Terminator.)

Solution 4 - Windows

JosepStyons is right. Open cmd.exe and run

taskkill /im processname.exe /f

If there is an error saying,

> ERROR: The process "process.exe" with PID 1234 could not be > terminated. > Reason: Access is denied.

then try running cmd.exe as administrator.

Solution 5 - Windows

Get process explorer from sysinternals (now Microsoft)

Process Explorer - Windows Sysinternals | Microsoft Docs

Solution 6 - Windows

One trick that works well is to attach a debugger and then quit the debugger.

On XP or Windows 2003 you can do this using ntsd that ships out of the box:

ntsd -pn myapp.exe

ntsd will open up a new window. Just type 'q' in the window to quit the debugger and take out the process.

I've known this to work even when task manager doesn't seem able to kill a process.

Unfortunately ntsd was removed from Vista and you have to install the (free) debbugging tools for windows to get a suitable debugger.

Solution 7 - Windows

setup an AT command to run task manager or process explorer as SYSTEM.

AT 12:34 /interactive "C:/procexp.exe"

If process explorer was in your root C drive then this would open it as SYSTEM and you could kill any process without getting any access denied errors. Set this for like a minute in the future, then it will pop up for you.

Solution 8 - Windows

I had this issue too, here is how I solved it.

1/ Open the « task manager « 

2/ Locate the application name in the list

3/ Once found, right click on its name then click on « properties »

4/ In the properties interface, click on « security « 

5/ Click on « edit » to change permissions

6/ « Deny » all permissions for all users, click on «  apply » then « ok »

7/ click on « advanced » for special permissions settings

8/ Remove permissions for all users

9/ click on «  apply » then « ok »

10/ click on «  apply » then « ok » again

11/ you can now kill the process on task manager as well as uninstall the app of you want to.

Solution 9 - Windows

When ntsd access is denied, try:

ZeroWave was designed to be a simple tool that will provide a multilevel termination of any kind of process.

ZeroWave is also a easy-to-use program due to its simple installation and its very friendly graphical interface.

ZeroWave has three termination modes and with the "INSANE" mode can terminate any kind of process that can run on Windows.

It seems that ZeroWave can't kill avp.exe

Solution 10 - Windows

FYI you can sometimes use SYSTEM or Trustedinstaller to kill tasks ;)

google quickkill_3_0.bat

sc config TrustedInstaller binPath= "cmd /c TASKKILL /F  /IM notepad.exe
sc start "TrustedInstaller"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionEli CourtwrightView Question on Stackoverflow
Solution 1 - WindowspilifView Answer on Stackoverflow
Solution 2 - WindowsJosephStyonsView Answer on Stackoverflow
Solution 3 - Windowsuser541686View Answer on Stackoverflow
Solution 4 - WindowsDhruv ChandhokView Answer on Stackoverflow
Solution 5 - WindowsIain HolderView Answer on Stackoverflow
Solution 6 - WindowsRob WalkerView Answer on Stackoverflow
Solution 7 - WindowsDavid RuarkView Answer on Stackoverflow
Solution 8 - WindowsGeekOnHeels01View Answer on Stackoverflow
Solution 9 - WindowsdiyismView Answer on Stackoverflow
Solution 10 - WindowsRmccurdyDOTcomView Answer on Stackoverflow