How to read the standard output during runtime?
Hello all,
I need your advice please:
I execute shell command that can take up to 5 minutes. This command command writes to standard output during its running.
I'm using this way:
Code:
With CreateObject("wscript.shell")
AllocConsole
ShowWindow GetConsoleWindow, SW_HIDE
commandExec = "cmd /c blahblah"
With .exec(commandExec)
line = .stdout.readall
end with
My question: How can I read the standard output during it's running? As you can see, I get the standard out AFTER the "cmd /c" execution is finished (5 minutes....). I'd like to see it and display it in REAL time.
I'd like to show it to users just as the output is updated (like UNIX "tail" command), so if you know a good way to implement this also, it will be very appreciated.
Thanks in advance!
Re: How to read the standard output during runtime?
vb Code:
With .StdOut
If Not .AtEndOfStream Then
DoEvents
Text1.SelStart = Len(Text1.Text)
Text1.SelText = .ReadAll()
End If
End With
or keep adding to str variable