[英]Error while kill process with QProcess::execute()
I've some problems with killing a process using taskkill
.我在使用
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): Output(从德语翻译):
ERROR: Invalid argument - "/IM testApp.exe".
Type "TASKKILL /?" to show the syntax.
"/IM testApp.exe" makes a single arg, but should be two args. "/IM testApp.exe" 生成一个 arg,但应该是两个 arg。 You get the command
taskkill /F "/IM testApp.exe"
.你得到命令
taskkill /F "/IM testApp.exe"
。 The proper invocation is正确的调用是
QStringList args;
args << "/F";
args << "/IM";
args << "testApp.exe";
QProcess::execute("taskkill", args);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.