I need to run an external exe through Qt application which requires commands to be entered in windows command prompt.
QString exePath = "C:\Windows\system32\cmd.exe";
QProcess pro;
pro.start(exePath);
pro.execute("cmd.exe");
But I got output like below plain cmd prompt
But I want windows command prompt like expected cmd
You need to read from QProcess standart output and print it on screen. You can use
pro.waitForReadyRead()
and if it returns true doBetter decision is to use signal slot mechanism and implement
onReadyToRead()
slot and connect QProcessreadyReadStandardOutput()
signal to it.You should not use this two methods at same time, QProcess::execute is static member.
You need to start process detached: