Details
Description
When a string of a stringlist contains such characters, it is not "quoted" when injected as a command line. To reproduce:
The batch file (C:\ListDir.bat) only has one line to print out the contents of a directory.
dir "%~1"
The Qt code is written like below.
#include <iostream> #include <QProcess> int main(int argc, char *argv[]) { QProcess proc(NULL); proc.start("C:\\ListDir.bat", QStringList() << "C:\\Comma,Directory\\ "); proc.waitForFinished(-1); std::cout << QString(proc.readAllStandardOutput()).toStdString().c_str(); return 0; }
As a result the command executed is "dir c:\Comma". the ",Directory" has been "lost" while "dir "c:\Comma,Directory" is a valid windows command.
Problem:
I think in qprocess_win.cpp, function static QString qt_create_commandline(const QString &program, const QStringList &arguments), the problem is that the argument should be quoted whatever characters it contains.