Reputation: 25
I've some problems with killing a process using taskkill
.
My code:
QStringList args;
args << "/F";
args << "/IM testApp.exe";
QProcess::execute("taskkill", args); //Should be 'taskkill /IM testApp.exe /F'
Output (translated from german):
ERROR: Invalid argument - "/IM testApp.exe".
Type "TASKKILL /?" to show the syntax.
Upvotes: 1
Views: 553
Reputation: 38332
"/IM testApp.exe" makes a single arg, but should be two args. You get the command taskkill /F "/IM testApp.exe"
. The proper invocation is
QStringList args;
args << "/F";
args << "/IM";
args << "testApp.exe";
QProcess::execute("taskkill", args);
Upvotes: 3