QProcess* process = new QProcess(this); process->start("E:/bin/Release/temp/test.exe"); //无法启动 QString path = "E:/bin/Release/temp/test.exe"; process->start(path); //无法启动 process->startDetached(path); //可以启动 QProcess::startDetached(path, QStringList(path)); //可以启动 //当程序路径中含有空格的时候,仅设置程序路径program是无法启动的。还需将程序路径传递给参数arguments。 QString path = "E:/bin/Release/temp/test v1_0_0.exe"; process->start(path); //无法启动 process->startDetached(path); //无法启动 process->startDetached(path, QStringList(path)); //可以启动 QProcess::startDetached(path, QStringList(path)); //可以启动 process->setProgram("E:/bin/Release/temp/test.exe"); process->setArguments(QStringList("E:/bin/Release/temp/test.exe")); process->start(); //无法启动
貌似start都不能启动,很奇怪。。。