[Qt-interest] QProcess problem when argument has space in windows Qt 4.5

Hari Panicker hari.panicker at yahoo.com
Sat Mar 14 01:00:43 CET 2009


Hi all

I am using Qt 4.5. I am trying start a msi install by calling msiexec.exe using QProcess. I am passing the path of the msi which has spaces in the path. I do put them between quotes. It just does not work... here is the code below

int SetupWrapper::startProcess(QString args)
{
QString program = "msiexec.exe " + args;
QProcess *myProcess = new QProcess(this);
myProcess->start(program);
myProcess->waitForFinished(-1);
int errorcode=myProcess->exitCode();
myProcess->close();
return errorcode;
}

void hari(...)
{
int res = startProcess("/i \"C:/New Folder/Dummy.msi\" MSIS=\"|C:/Documents and Settings/hari/Desktop/setup/store.msi|C:/Documents and Settings/hari/Desktop/setup/Tool.msi\"");
}

I even tried replacing \" with \"\"\" when argument has spaces after looking at this site
http://doc.trolltech.com/4.1/qprocess.html#start-2
like below....
void hari(...)
{
int res = startProcess("/i \"\"\"C:/New Folder/Dummy.msi\"\"\" MSIS=\"\"\"|C:/Documents and Settings/hari/Desktop/setup/store.msi|C:/Documents and Settings/hari/Desktop/setup/Tool.msi\"\"\"");
}

Nothing seems to work.... the msi does not get executes.. msiexec gives out error arguments wrong...

is this a bug or am i doing something wrong??? 

thanx 
Hari

Note: i tried this is C# and it works perfectly....


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090313/0eb2043c/attachment.html 


More information about the Qt-interest-old mailing list