prabhakaran
prabhakaran

Reputation: 5274

Qt - QProcess is not working

I try to launch internet explorer, So I use the below code

QProcess * process=new QProcess(this);
QString temp="C:\\Program Files\\Internet\ Explorer\\iexplore.exe";
process->startDetached(temp.toStdString().c_str());

But it doesn't work.

Upvotes: 4

Views: 13837

Answers (2)

Adam W
Adam W

Reputation: 3698

Try:

QProcess * process=new QProcess(this);
QString temp="\"C:\\Program Files\\Internet Explorer\\iexplore.exe\"";
process->startDetached(temp);

You need to use escaped quotes since the path has a space in it, or possibly escape all the spaces (you missed Program\ Files in the code you posted).

Upvotes: 8

mosg
mosg

Reputation: 12391

How about that?

QDir dir("C:\\");
QProcess::execute("explorer.exe", QStringList() << dir.toNativeSeparators(dir.path()));

Upvotes: 1

Related Questions