Tuesday 26 June 2018

windows - Kill a process with a specific "Command Line" from command line


Is there a command line utility that kills all processes with a specific command line?


E.g. kill all processes named "java.exe" with a command line that contains "-jar selenium-server.jar". This is possible through process explorer.



Answer



In Windows XP, you can do this easyly uing WMIC, the WMI Console. From a command propt, type the following:


wmic Path win32_process Where "CommandLine Like '%-jar selenium-server.jar%'" Call Terminate

Edit:


I replaced the alias 'process' by it full path ('path win32_process') as is Aviator's port. This alias may not be declared on every OS.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...