Capture and display STDOUT at the same time

后端 未结 2 1463
被撕碎了的回忆
被撕碎了的回忆 2020-12-10 07:29

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

2条回答
  •  情话喂你
    2020-12-10 08:09

    ConsoleWrite(_getDOSOutput('ipconfig /all') & @CRLF)
    
    Func _getDOSOutput($command)
        Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4)
        While 1
                $text &= StdoutRead($Pid, False, False)
                If @error Then ExitLoop
                Sleep(10)
        WEnd
        Return StringStripWS($text, 7)
    EndFunc   ;==>_getDOSOutput
    

    Maybe this helps you out.

提交回复
热议问题