taskkill doesn't kill process

Jeff M picture Jeff M · Dec 19, 2014 · Viewed 13.6k times · Source

I will sometimes get a process such that if I run taskkill /im the_process.exe /f /t, then it won't kill it, because: ERROR: The process with PID 6492 (child process of PID 5788) could not be terminated. Reason: There is no running instance of the task.

But if I open Task Manager and click End Process, then it goes away. Why does task manager work but taskkill not? I need to be able to kill the process programically, so I need to find a CLI command that will successfully kill this process.

I've googled around but I haven't found a working solution yet.

Answer

BenV136 picture BenV136 · Mar 18, 2016

Also, if are debugging the process under Visual Studio, you will get this exact situation. You need to detach the debugger or terminate the process from the debugger.