Reading Echo from .cmd file output using Qt
<p>I am attempting to run a .cmd file from the command line using Qt.  I need to be able to start the .cmd file and then I need to read the line output to be able to interpret whether it succeeded or not.</p>

<p>My .cmd file that I am testing with is as follows:</p>

<pre><code>@ECHO OFF
ECHO myBat Started.
ECHO myBat Ended.
</code></pre>

<p>Running this from the command line gives me "myBat Started." followed by "myBat Ended."</p>

<p>Below is my code that I am attempting to read the data output from.</p>

<pre><code>QString batName = "/path/to/*.cmd";
QProcess p;
qDebug() &lt;&lt; "starting command";
p.start("cmd.exe", QStringList() &lt;&lt; batName);
if (p.waitForStarted()){
   qDebug() &lt;&lt; "cmd started";
   p.waitForFinished();
   qDebug() &lt;&lt; p.readAllStandardOutput();
} else {
    qDebug() &lt;&lt; "Failed to start";
}
</code></pre>

<p>When I run this, I get "starting command", followed by "cmd started", followed by "".  So I am opening the console correctly (I think), it finishes, but then I am not getting any of the data output.</p>

<p>What do I need to change to read the command line output?</p>