Jump to content

Capture Run/DOS command output as well print on STDOUT


Recommended Posts

I have the following code to capture and process the Run command output.

Now how do i modify such that the Run command window and output is active and at the same time captured and logged?

P.S.Replacing @SW_HIDE with @SW_SHOW or the equivalent just shows the blank command window (all command execution truncated)

Something similar to the function of linux "tee" command which logs into the file as well prints on STDOUT.

$CurrentPID = Run(@ComSpec & ' /c ' & $CurrentLogCmd, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
If Not ProcessWaitClose($CurrentPID,60) Then
WriteLog("[Warning] Timed-out.Finding date in current hour raw log -" & $CurrentLogFileName)
$F_LogWarningExist=1
Return $C_SUCCESS ; Take chances and proceed with parsing raw logs
EndIf
$CurrentOutput = StdoutRead($CurrentPID)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...