我有一個非常奇怪的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)
功能三倍「\」\「,它也不工作。我想這個問題的解決方案必須非常容易,以至於我不會去想它。