我对QProcess有一个大问题(我使用Qt c ++)。我需要执行具有管理员权限的命令(Windows 7)-netsh-我必须向防火墙添加例外。
proc->start("powershell",QStringList()<<"-Command"<<"Start-Process"<<"powershell.exe"<<"-Verb"<<"runas"<<"-ArgumentList"<<R"('here is netsh command')");
proc->waitForStarted();
qInfo()<<"before";
proc->waitForFinished(-1);
qInfo()<<"yeah!";
当我执行程序时,我只会看到“之前”。我能做什么?我在powershell中检查了netsh命令-很好。