Taskkill /f doesn't kill a process

503,459

Solution 1

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

Solution 2

The taskkill and powershell (kill) methods didn't work for me; it still said "Access Denied".

I had better luck with this:

wmic process where "name='myprocessname.exe'" delete

Solution 3

Reboot is the only solution that worked for me (so far).

The ever excellent Mark Russonovich has a good explanation for unkillable processes.

To summarise, it's quite possible it is due to unprocessed I/O requests that hasn't been handled properly (by a device driver your program has possibly accessed)

https://techcommunity.microsoft.com/t5/windows-blog-archive/unkillable-processes/ba-p/723389

Solution 4

Just had the same issue on Windows Server 2008 R2 and nothing helped, not taskmanager or taskkill. But, windows powershell run as administrator worked with "kill -id pid"

Solution 5

I know it's late but taskkill /im devenv.exe /t /f should work. the /t kills child processes too.

Share:
503,459

Related videos on Youtube

dushyantp
Author by

dushyantp

Updated on January 28, 2022

Comments

  • dushyantp
    dushyantp over 2 years

    When I start up an Experimental instance of VS from VS for debugging and stop debugging (sometimes directly from the parent VS), a zombile devenv.exe process remains running which I am unable to kill. It holds on to many of my dlls.

    As I am logged onto this 64bit Win7 machine as Administrator, I would expect to be able to kill any process I wish to.

    I tried (from Administrator command prompt):
    
    End Task from Task Manager.
    TASKKILL /F /IM devenv.exe
    PSKILL devenv.exe
    

    None return any error and TASKKILL and PSKILL returned success messages of terminating/killing the process. But devenv.exe still runs, it is not re-spawned as the PID remains constant. It goes away only on restart of the system which is not a great solution.

    Note. LockHunter shows devenv has got a lock on itself. And it cannot unlock it.

    Process Monitor shows devenv to be in some kind of 'Process Profiling' loop

    The above screenshot is the output of Process Monitor showing devenv to be in some kind of 'Process Profiling' loop (Right click on it and click open image in new tab to see it properly).

    Any ideas how to kill such a process on Windows?

    • SvenS
      SvenS almost 12 years
      No idea why you don't get an error, but to verify one thing: Did you call these commands from an elevated command prompt? Otherwise the commands will not run with Administrator privileges, even though your account has them. (This shouldn't allow them to return success when they clearly failed though ;))
    • dushyantp
      dushyantp almost 12 years
      yes all commands were run from Administrator command prompts.
    • Jarekczek
      Jarekczek over 11 years
      This sort of question is more appropriate on superuser.com. Yup, they have quite good explanations there. This one helped me.
  • dushyantp
    dushyantp almost 12 years
    any hints on how to work this out? On taskmanager it doesn't show any service corresponding to devenv.exe Right now I am trying to recreate the problem, once done I will use process explorer to dig into services which could be holding it.
  • Scott Whitlock
    Scott Whitlock over 10 years
    This doesn't seem to work for me. It says it's successful, but the process still shows up.
  • Scott Whitlock
    Scott Whitlock over 10 years
    I tried killing and restarting explorer.exe and that didn't work.
  • rboy
    rboy about 10 years
    I'm facing a similar issue too but with microsoft ftp service, says terminated but continues to run cant figure it out
  • manocha_ak
    manocha_ak over 9 years
    Sadly yes! For me also it's the case. did you ever get any solution?
  • Jesse Chisholm
    Jesse Chisholm about 9 years
    If instead of /IM devenv.exe I use /PID 17888 then the error basically said that 17888 is a child of 17880 and 17880 isn't running and so can't be killed.
  • CodeManX
    CodeManX almost 9 years
    It prints two success messages in my case, but the process is still there. What the hell?
  • Admin
    Admin almost 9 years
    if that would be so easy :) no, it doesn't help. I think his problem is because the unkillable process is in some loop (socket, i/o, pipes...) where the main process is system process and killing it will make system unstable. It that case I would recomend first to understand what loop is the process in. Then, if that loop is network exchange with other endpoint, then just unplug network cable or disconnect the already established connection.
  • J. Paulding
    J. Paulding over 8 years
    This worked for me... though there seemed to be about a 30 second delay before the process actually went away, so at first it seemed to fail. In the case that I had it was a process that was created procedurally by another application while the system was low on resources. Process Explorer, kill process tree, and several other things failed to work, but this did the trick.
  • demongolem
    demongolem about 8 years
    I get a There is no running instance of the task That process really does not want to die!
  • Hoàng Long
    Hoàng Long almost 8 years
    still help me today, though I have to kill the "child of the child" too: taskkill /f /T /PID 4172 ==> ERROR: The process with PID 4172 (child process of PID 4724) could not be terminated. ==> taskkill /f /T /PID 4724 ==> Done
  • user1133275
    user1133275 over 7 years
    It's possible for the parent PID to not exist.
  • user1133275
    user1133275 over 7 years
    ERROR: Description = Invalid query
  • FractalSpace
    FractalSpace over 7 years
    Windows-10. Also: ERROR: Description = Access denied (Using Admin console btw)
  • rboy
    rboy over 7 years
    Didn't work for me, gave me an error unable to kill process etc etc
  • kayleeFrye_onDeck
    kayleeFrye_onDeck about 7 years
    Yay for the under-mentioned /T switch!
  • Chris Jones
    Chris Jones about 7 years
    @rboy . I know its old, but just in case someone else sees this do what I did. Open powershell as Administrator and then run it. At first I ran it not as admin and it told me I couldn't do it. So then I ran it as admin and it worked.
  • jk1990
    jk1990 almost 7 years
    This worked for me, when none of the others did. Thx :D
  • bluish
    bluish over 6 years
    Please specify what gdb and Code::Blocks are ;)
  • M.M
    M.M over 6 years
    Warning: if the parent process is services.exe then killing parent may cause BSOD
  • karan
    karan over 6 years
    this works but make sure you are using cmd from admin mode.
  • Eduardo Elias Saléh
    Eduardo Elias Saléh about 6 years
    Thank you! That worked like a charm for my stuck npm
  • zhaorufei
    zhaorufei about 6 years
    On Win10 still failed: Deleting instance \\DESKTOP-HJC3KKE\ROOT\CIMV2:Win32_Process.Handle="41236" ERROR: Description = Access denied
  • zhaorufei
    zhaorufei about 6 years
    Not worked for me on win10: PS D:\work\Projects\libtiff.net_bin-2.4.560.0> Get-Process NSPRip | kill PS D:\work\Projects\libtiff.net_bin-2.4.560.0> echo $? True PS D:\work\Projects\libtiff.net_bin-2.4.560.0> Get-Process NSPRip Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 0 0 56 20 0.00 41236 1 NSPRip
  • ThetaSinner
    ThetaSinner about 6 years
    This worked for me on Windows 10 with a misbehaving Windows service. Had already tried CMD, in this case PowerShell is the right tool
  • Derek MC
    Derek MC about 6 years
    Amazing, thanks so much. Spent an hour on kill before I found this
  • John Newman
    John Newman about 6 years
    This actually worked, should be accepted answer. Thanks
  • BrunoLM
    BrunoLM about 6 years
    Powershell equivalent Get-WmiObject -Query "select * from win32_process where name = 'node.exe'" | Remove-WmiObject
  • Tarun Gupta
    Tarun Gupta almost 6 years
    No luck for me even after waiting for more than 2-3 mins. none of the command is working for me currently
  • twasbrillig
    twasbrillig almost 6 years
    Didn't work for me. Got: Unable to kill process 10576: Access is denied.
  • twasbrillig
    twasbrillig almost 6 years
    Didn't work for me. Got End Process failed for 10576:Access is denied.
  • das Keks
    das Keks almost 6 years
    How did you discover that the update caused it? I think I would have never discovered that. ^^'
  • Danita
    Danita almost 6 years
    I realized the only thing that changed in my machine before the issue become apparent was the updates, so I checked which was my last update and read the release notes. It seemed suspicious and I rolled back to see if the issue was solved, which it was. Then I read on some Apache forums, don't remember which, that this update has caused trouble for them too. BTW: Last Windows Update as of 2018/Aug/10 fixes the problem with KB4338818, so it can be installed again.
  • wctiger
    wctiger almost 6 years
    This one still doesn't work in my case. Have a Visual Studio stuck in processes, ran the command and it says Deleting instance \\MyMachine\ROOT\CIMV2:Win32_Process.Handle="6420", Instance deletion successful. But after 5 mins I still see the VS devenv.exe process in task manager list. I guess nothing but a reboot is the only solution for me.
  • Malganis
    Malganis almost 6 years
    When I run wmic command from gitbash, I have to include the query in quotes. Your command should then become: wmic process where "name='myprocessname.exe'" delete
  • twasbrillig
    twasbrillig almost 6 years
    Thanks @Malganis, I updated the answer with that change.
  • Gellie Ann
    Gellie Ann over 5 years
    What I did is shut it down, then restart it.
  • sk8asd123
    sk8asd123 over 5 years
    If you get an error such as: 'nestat' is not recognized as an internal or external command, operable program or batch file. you may need to run the command as C:\Windows\system32\netstat.exe instead of just nestat
  • BenV136
    BenV136 over 5 years
    You may need to do it from a command shell with admin rights?
  • dvlper
    dvlper over 5 years
    Happening the same for me. What I cannot understand, is why? taskkill is supposed to be the same as tskill [rather better, in documentation etc.]. If someone could answer?
  • tibx
    tibx about 5 years
    in case of „There is no running instance of the task“ it must be killed some associated process which holds lock on this process, for example devenv.exe is associated with some_debugged_process.exe
  • robertspierre
    robertspierre over 4 years
    Seems there is no tskill in Windows 10
  • Máster
    Máster over 4 years
    Please give more details about what to do next after running CMD as Admin.
  • Facundo Colombier
    Facundo Colombier over 4 years
    When I did taskkill /IM "process_name" /T /F part of the response was: (child process of PID xxxx) so I checked that PID and it was explorer.exe, restarting it solved my issue.
  • Justin
    Justin over 4 years
    YAY! this has been affecting the enjoyment of my LIFE. thank you
  • David Spector
    David Spector about 4 years
    Did not work for me, trying to delete the Windows Defender process that uses near 100% of disk access..
  • David Spector
    David Spector about 4 years
    Did not work for me, trying to delete the Windows Defender process that uses near 100% of disk access..
  • David Spector
    David Spector about 4 years
    Did not work for me, trying to delete the Windows Defender process that uses near 100% of disk access..
  • David Spector
    David Spector about 4 years
    Did not work for me, trying to delete the Windows Defender process that uses near 100% of disk access..
  • Aadam
    Aadam about 4 years
    What nonsese windows is, it's own commands cannot end it own task, its irritating. Now I understand why real enterprise apps use UNIX
  • Erik Aronesty
    Erik Aronesty almost 4 years
    was really hoping.... deleting the command didn't work... access denied (even tho admin)
  • Mario
    Mario over 3 years
    Worked for me in Windows 10 Pro, calling from Java. taskkill did not work, so this was the solution I found.
  • Elliott B
    Elliott B over 3 years
    The "Invalid Query" error happens if you don't quote it properly
  • Martas
    Martas over 3 years
    For me computer doesn't restart, freezes on Restarting ... screen, mouse is moving. I can wait 2 hours and then I must manually switch it off by button.
  • Matt Kleinsmith
    Matt Kleinsmith about 3 years
    Visual Studio was protecting the process, in my case.
  • XavierTheGreat
    XavierTheGreat about 3 years
    Wanted to add my two cents and say this is the command that ACTUALLY worked for me when the other one failed miserably. Thanks.
  • Mouffette
    Mouffette almost 3 years
    pskill64 at command shell with admin rights didn't work for me either. same error "access is denied."