我有一个非常奇怪的QProcess问题,这是奇怪的行为。QProcess和命令行“/ c”参数
我想获得在最后是这样的(这是在Windows 7中的cmd.exe)
C:\path_to_somewhere>cmd /c "C:\Program Files\path_to_dir\executable"
(CMD是与QProcess中的显示兼容性)
所以做一些事情像我创建这个:
QProcess proc;
QString command;
QStringList attributes;
command = "c:\\windows\\system32\\cmd.exe";
QStringList << QString("/c \"C:\\Program Files\\path_to-dir\\executable"");
proc.start(command, attributes);
什么,我会在错误的输出是:
Name '\"c:\Program Files\Quantum GIS Wroclaw\bin\gdalwarp.exe\"' is not recognized as
internat or external command, executable or batch file.
(这是我从波兰语翻译过来的,所以它在英语中可能有点不同)。
好像\字符没有在字符串中逃脱,留下了\”为命令字符。我在做什么错?
我已经试过与
proces.start(QString)
功能三倍“\”\“,它也不工作。我想这个问题的解决方案必须非常容易,以至于我不会去想它。