title: WScript.Shell.Exec - read output from stdout
body: <p>My VBScript does not show the results of any command I execute. I know the command gets executed but I would like to capture the result.</p>
  <p>I have tested many ways of doing this, for example the following:</p>
  <pre><code>Const WshFinished = 1
  Const WshFailed = 2
  strCommand = &quot;ping.exe 127.0.0.1&quot;
  
  Set WshShell = CreateObject(&quot;WScript.Shell&quot;)
  Set WshShellExec = WshShell.Exec(strCommand)
  
  Select Case WshShellExec.Status
     Case WshFinished
         strOutput = WshShellExec.StdOut.ReadAll
     Case WshFailed
         strOutput = WshShellExec.StdErr.ReadAll
   End Select
  
  WScript.StdOut.Write strOutput  'write results to the command line
  WScript.Echo strOutput          'write results to default output
  </code></pre>
  <p>But it does not print any results. How do I capture <code>StdOut</code> and <code>StdErr</code>?</p>