I have seen that is possible to use
wmic to find the
id of a process searching for the
command line which was used to start it.
But I have 2 problems.
- I need to use this in a batch file so I cannot read the output of the wmic and call the taskkill I must use some kind of grep
- I couldn't find how to search for a partial match. I prefer to search for a piece of the commandline.
What I could find is this example:
wmic process where "CommandLine=start.bat", pid
But what I would like to do is more similar to:
wmic process where "CommandLine like %start.bat%", pid | taskkill
This is what I mean by command line: "cmd.exe" /c C:\Mysql\start.bat"
Is there a way to kill a process searching for the command line which started it?