pra*_*ran 3 c++ user-interface qt qprocess
我尝试启动Internet Explorer,所以我使用下面的代码
QProcess * process=new QProcess(this);
QString temp="C:\\Program Files\\Internet\ Explorer\\iexplore.exe";
process->startDetached(temp.toStdString().c_str());
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
尝试:
QProcess * process=new QProcess(this);
QString temp="\"C:\\Program Files\\Internet Explorer\\iexplore.exe\"";
process->startDetached(temp);
Run Code Online (Sandbox Code Playgroud)
您需要使用转义引号,因为路径中有空格,或者可能转义所有空格(您Program\ Files在发布的代码中遗漏了这些空格).