title: Capture and display STDOUT at the same time
body: <p>I have the following code to capture and process the Run command output.
  How do I modify it such that the Run command window displays output and at the same time the output gets logged? Replacing <code>@SW_HIDE</code> with <code>@SW_SHOW</code> (or the equivalent) just shows a blank command window.</p>
  
  <p>Something similar to the linux <code>tee</code> command which logs to file while it prints STDOUT.</p>
  
  <pre><code>$CurrentPID = Run(@ComSpec &amp; ' /c ' &amp; $CurrentLogCmd, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
  
  If Not ProcessWaitClose($CurrentPID,60) Then
      WriteLog("[Warning] Timed-out.Finding date in current hour raw log -" &amp; $CurrentLogFileName)
      $F_LogWarningExist = 1
      Return $C_SUCCESS ; Take chances and proceed with parsing raw logs
  EndIf
  
  $CurrentOutput = StdoutRead($CurrentPID)
  </code></pre>