I'm trying to kill an .exe with subprocess.Popen.
Solution as:
taskkill /im (.exe) /t /f
taskkill /pid (.exe) /t /f
aren't working as the response is access denied. Indeed, as i'm running the cmd from subprocess i'm not able to obtain admin privilegies.
I've found a command to kill this process from cmd (without running it as admin) which is:
wmic process where name=".exe" delete
... but when i'm running it with subprocess it gives me "invalid query
".
The command i'm running is:
4)subprocess.Popen(['wmic', 'process', 'where', 'name="-------.exe"', 'delete'], shell=True, stdout=subprocess.PIPE)
I suppose that i'm writing it wrongly. Some advices?