windows Taskkill /f 不会杀死进程

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12528963/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 09:54:29  来源:igfitidea点击:

Taskkill /f doesn't kill a process

windowswindows-7processwindows-7-x64devenv

提问by dushyantp

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.

当我从 VS 启动一个 VS 的实验实例以进行调试并停止调试(有时直接从父 VS 启动)时,我无法杀死一个 zombile devenv.exe 进程仍在运行。它保留了我的许多 dll。

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

当我以管理员身份登录到这台 64 位 Win7 机器时,我希望能够杀死我希望的任何进程。

I tried (from Administrator command prompt):

End Task from Task Manager.
TASKKILL /F /IM devenv.exe
PSKILL devenv.exe

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

无返回任何错误TASKKILLPSKILL终止的/返回成功信息杀死进程。但是 devenv.exe 仍然运行,它不会重新生成,因为它PID保持不变。它仅在系统重新启动时消失,这不是一个很好的解决方案。

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

笔记。LockHunter 显示 devenv 已经锁定了自己。它无法解锁它。

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

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).

上面的屏幕截图是 Process Monitor 的输出,显示 devenv 处于某种“Process Profiling”循环中(右键单击它并单击新选项卡中的打开图像以正确查看它)。

Any ideas how to kill such a process on Windows?

任何想法如何在 Windows 上终止这样的进程?

回答by aaa

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

回答by twasbrillig

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

taskkill 和 powershell (kill) 方法对我不起作用;它仍然说“拒绝访问”。

I had better luck with this:

我有更好的运气:

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

回答by Gnampf

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"

刚刚在 Windows Server 2008 R2 上遇到了同样的问题,但没有任何帮助,而不是 taskmanager 或 taskkill。但是,以管理员身份运行的 Windows PowerShell 使用“kill -id pid”

回答by Francis

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

重启是唯一对我有用的解决方案(到目前为止)。

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

永远优秀的 Mark Russonovich 对不可杀死的过程有一个很好的解释。

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)

总而言之,很可能是由于未处理的 I/O 请求未正确处理(由您的程序可能访问过的设备驱动程序)

http://blogs.technet.com/b/markrussinovich/archive/2005/08/17/unkillable-processes.aspx

http://blogs.technet.com/b/markrussinovich/archive/2005/08/17/unkillable-processes.aspx

回答by nephi12

I know it's late but taskkill /im devenv.exe /t /fshould work. the /tkills child processes too.

我知道已经晚了,但taskkill /im devenv.exe /t /f应该工作。在/t杀死子进程了。

回答by Danita

In my case, after several days of fighting with this problem (it was happening to VirtualBox and μTorrent processes), I discovered it was caused by a network driver issue, provoked by Windows Update patch KB4338818(Windows 7 x64). After uninstalling that patch everything went back to normal. I just thought it could be useful for others.

就我而言,经过几天与这个问题的斗争(它发生在 VirtualBox 和 μTorrent 进程中),我发现它是由网络驱动程序问题引起的,由 Windows 更新补丁KB4338818(Windows 7 x64) 引起。卸载该补丁后,一切恢复正常。我只是认为它可能对其他人有用。

回答by seansilver

I could solve my issue rearding this problem by killing explorer.exe which in turn was addicted to the process I wanted to kill. I guess this may also happen if processes open interfaces via hook which may be locked.

我可以通过杀死 explorer.exe 来解决这个问题,这反过来又沉迷于我想杀死的进程。我想如果进程通过可能被锁定的钩子打开接口,这也可能发生。

回答by Thomas Lee

I've seen this a few times and my only solution was a re-boot.

我已经看过几次了,我唯一的解决方案是重新启动。

You could try using PowerShell: Get-Process devenv | kill

您可以尝试使用 PowerShell:Get-Process devenv | 杀

But if the other methods failed, this probably will too. :-(

但如果其他方法失败,这可能也会失败。:-(

回答by Zig

Native tskill <pid>(or tskill.exe <pid>) worked for me on Windows 10 where no other native answer did.

本机tskill <pid>(或tskill.exe <pid>)在 Windows 10 上对我来说有效,而没有其他本机答案。

In my case, I had some chrome.exe processes for which task manager's 'End Task' was working, but neither taskkill /F /T /PID <pid>nor powershell's kill -id <pid>worked (even with both shells run as admin).

就我而言,我有一些 chrome.exe 进程,任务管理器的“结束任务”正在为其工作,但无论taskkill /F /T /PID <pid>是 powershell 还是 powershell都不起作用kill -id <pid>(即使两个 shell 都以管理员身份运行)。

This is very strange as taskkillis purported to be a better-api-and-does-more version of tskill.

这很奇怪,因为taskkill据称是更好的 api-and-does-more 版本tskill

In my case to kill all instances of a certain task I used FOR /F "usebackq tokens=2 skip=2" %i IN (`TASKLIST /FI "IMAGENAME eq name_of_task.exe"`) DO tskill %i

在我的情况下,杀死我使用的某个任务的所有实例 FOR /F "usebackq tokens=2 skip=2" %i IN (`TASKLIST /FI "IMAGENAME eq name_of_task.exe"`) DO tskill %i

回答by Astroynamicist

I am going to suggest something here because I recently faced the same issue and I tried every possible thing in the answers but nothing worked. I was getting errors like

我要在这里提出一些建议,因为我最近遇到了同样的问题,我在答案中尝试了所有可能的方法,但没有任何效果。我收到了类似的错误

ERROR: The process with PID 23908 could not be terminated. Reason: There is no running instance of the task.

错误:无法终止 PID 为 23908 的进程。原因:没有正在运行的任务实例。

using command prompt. Power shell wasn't helpful either. it would simply execute the commands and no response with process still running.

使用命令提示符。Power shell 也没有帮助。它只会执行命令,而进程仍在运行时没有响应。

Until I decided to delete the associated '.exe' file. Since the file was active, windows would not allow the deletion, but in that warning window it gave me the name of the process which was holding up the task I wanted to kill. I was able to kill the original task and thus the buggy process.

直到我决定删除关联的“.exe”文件。由于文件处于活动状态,Windows 不允许删除,但在该警告窗口中,它给了我阻止我想要终止的任务的进程的名称。我能够终止原始任务,从而终止有问题的过程。

It is definitely worth a try if none of the solutions works out.

如果没有一个解决方案奏效,那绝对值得一试。