ASDasasd Dasdasdrqw
ASDasasd Dasdasdrqw

Reputation: 1

How to start a process in Windows using QT?

I'm trying to start a console application on Windows using QProcess's method 'start'. Official documentation says I can do it like this:

QProcess process;
process.start("C:/Windows/System32/cmd.exe");

I expect that a standard greeting message will appear in the calling application's console, but this does not happen, though the called process is running. What is wrong here?

Upvotes: 0

Views: 2179

Answers (2)

The Quantum Physicist
The Quantum Physicist

Reputation: 26276

How about this static call?

QProcess::startDetached(FilePath,Arguments,StartInDir);

No need to create any objects!

Upvotes: 1

use of bellow example :

QProcess *process = new QProcess(this);
QString program = "explorer.exe";
QString folder = "C:\";
process->start(program, QStringList() << folder);

also you can use of system() as bellow :

system("C:/Windows/System32/cmd.exe");

Upvotes: 1

Related Questions