LOL! For the past few months, I've been developing a VB.NET app that acts as
a front end to several PERL apps. I use the shell command (in a thread) to
start a PERL app and in one command pass all of the command line arguments
(values from Textboxes, comboboxes, etc.) to the PERL App.
Then, using the sledgehammer approach, I setup a TCPListener in a thread to
read the output from the perl app(Of course, I had to add the TCPClient
functionality to all of my PERL apps!!)
For some reason, I just never thought about simply redirecting the output of
the command window itself.
I'll have to make a small test app to see if redirecting the output (as you
stated) works as well as the TCPListener/TCPclient setup.
In some of my initial attempts at controlling the PERL app from a VB App, I
noticed that SendKeys does not work if the command window is hidden. Will
redirecting the output work if the command window is hidden?
regards,
Lee
Joseph MCAD said:
April 7, 2005
You have to set the Process.Startinfo.RedirectStandardOutput property.
You can then access the Process.StandardOutput to retrieve a Streamreader
that has the output....
dim p as new process
p.startinfo.filename = "..."
p.startinfo.redirectstandardoutput = true
p.start
dim reader as new streamreader = p.standardoutput
messagebox.show(reader.readtoend)
Hope this helps!
Joseph MCAD