How to kill a process based on its image / file path?

纵饮孤独 提交于 2020-01-11 07:23:50

问题


How to kill a task based on the path of the executable?

The usage of taskkill /F /IM "app.exe" doesn't work in this case because there are other programs running that have the same image/process/file name, but are totally different executables. The paths are different and the .exe files with same file name are different, too.

Something like "taskkill /F /IM "C:\path\to\exe\app.exe" would be ideal.


回答1:


Using WMIC, as suggested in the comments by Squashman, you can do it as a single command:

WMIC Process Where "ExecutablePath='C:\\path\\to\\exe\\app.exe'" Call Terminate


来源:https://stackoverflow.com/questions/50804813/how-to-kill-a-process-based-on-its-image-file-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!