Capture Console Output
Hi
Im using VisualBasic6 and have the following to execute an external program and wait for it's execution:
Dim wScr as Object
Set wScr = CreateObject("WScript.Shell")
Call wScr.Run("myprogram.exe", 1, true)
"myprogram.exe" generates some output to a file, and also some error-messages in the console window (DOS).
How do I capture this output?
I want the program to be able to execute on Windows NT/2000/XP/2003.
Is there a good idéa to use "WScript.Shell"?
Or should I call the external program in another way or anything that maybe makes it safer to be able to execute on the above systems?
Regards
Andreas
I do the same to run external console application and capture output to show it in log window(Code is in C# though)
wshShell = new WshShellClass();oExec = wshShell.Exec( cmdStr ); string Str = null; while ( oExec.Status == 0 ) { try { Str = oExec.StdOut.ReadLine(); // output Str string to wherever i'd like } catch {} }
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement