I'm using a vbscript to run an external batch script. I am using the following code to process the output of the batch script so it can be view in the same window. The only problem that I am having is that the following code only pulls the output after the batch script completes. I'm trying to figure out how to pull the output while the batch script is running. I tried using stdout.readline, but it only returns the first line.
Function Run (ByVal cmd)
Dim sh: Set sh = CreateObject("WScript.Shell")
Dim wsx: Set wsx = Sh.Exec(cmd)
If wsx.ProcessID = 0 And wsx.Status = 1 Then
Err.Raise vbObjectError,,"WshShell.Exec failed."
Dim Status: Status = wsx.Status
If Status <> 0 Then Exit Do
Run = wsx.ExitCode
' Runs an internal command interpreter command.
Function RunCmd (ByVal cmd)
RunCmd = Run("%ComSpec% /c " & cmd)
return = run("c:\myscript.bat")