Can VB read every line of output from a program running in CMD while it is still running?


I have a VB question for you, and although I saw several similar questions asked earlier, I have a little twist to it. I would like to know if it is possible to read every line of output from an external program running in CMD.exe that was launched using VB. Here's a twist: I would like to read this information while the external program is still working, NOT ONE THAT IT IS COMPLETED.

I can be confused about what constitutes an "exit", so let me give an example for those who have more knowledge to guide me.

In my VB program, suppose I pass this command to CMD.exe:
someprogram.exe -param1 ABCD -param2 1234

Now suppose that someprogram.exe starts, and as it does its work, the following applications are in CMD:
Output line 1
Output line 2
Output line 3
...

While someprogram.exe is still working, I would like to read each of the above output lines (if that is the correct term) so that my VB program can summarize this information for the user. I have seen examples with commandexecutor and others using Environment.GetCommandLineArgs, but every example that I see is to read the result as soon as the external program has finished.

Is it possible to do what I ask in VB?

+3
source share
1 answer

, Process.Start, , RedirectStandardOuput ProcessInfo . . #.

+1

All Articles