Autoit - Capture Run/DOS command output as well print on STDOUT -
i have following code capture , process run command output. how modify such run command window , output active , @ same time captured , logged?
p.s.replacing @sw_hide @sw_show or equivalent shows blank command window (all command execution truncated)
something similar function of linux "tee" command logs file prints on stdout.
$currentpid = run(@comspec & ' /c ' & $currentlogcmd, "", @sw_hide, $stderr_child + $stdout_child) if not processwaitclose($currentpid,60) writelog("[warning] timed-out.finding date in current hour raw log -" & $currentlogfilename) $f_logwarningexist=1 return $c_success ; take chances , proceed parsing raw logs endif $currentoutput = stdoutread($currentpid)
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 exitloop sleep(10) wend return stringstripws($text, 7) endfunc ;==>_getdosoutput
maybe helps out.
Comments
Post a Comment