By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,656 Members | 748 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,656 IT Pros & Developers. It's quick & easy.

Executing a DOS type command from VB.NET and retrieving its ouput

P: n/a
Please point me to some articles that explain how to execute a dos type
command and retrieve its output for processing.
Thanks.
Nov 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
James,

Here beneath a simple sample, however did you know that there was a special
newsgroup for VB.net language
microsoft.public.dotnet.languages.vb

\\\
Public sub myStart() as String
Dim p As New Process
dim pi as new processstartinfo
pi.UseShellExecute = False
pi.RedirectStandardOutput = True
pi.Arguments = myargumentstring
pi.WorkingDirectory = myworkdirectorystring
pi..FileName =C:\myprogram
pi.startinfo = pi
p.Start()
Dim sr As IO.StreamReader = p.StandardOutput
Dim sb As New System.Text.StringBuilder("")
Dim input As Integer = sr.Read
Do Until input = -1
sb.Append(ChrW(input))
input = sr.Read
Loop
Return SB.tostring
///

I hope this helps?

Cor

"James D. Marshall" <cr**********@hotmail.com>
Please point me to some articles that explain how to execute a dos type
command and retrieve its output for processing.
Thanks.

Nov 22 '05 #2

P: n/a
Thank you that does help a lot.
One question on parsing, the line has double carriage returns that show up
as squares, I am seeing this through watch1, how would you code a replace
statement to get rid of these, its driving me batty.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uc**************@TK2MSFTNGP15.phx.gbl...
James,

Here beneath a simple sample, however did you know that there was a
special newsgroup for VB.net language
microsoft.public.dotnet.languages.vb

\\\
Public sub myStart() as String
Dim p As New Process
dim pi as new processstartinfo
pi.UseShellExecute = False
pi.RedirectStandardOutput = True
pi.Arguments = myargumentstring
pi.WorkingDirectory = myworkdirectorystring
pi..FileName =C:\myprogram
pi.startinfo = pi
p.Start()
Dim sr As IO.StreamReader = p.StandardOutput
Dim sb As New System.Text.StringBuilder("")
Dim input As Integer = sr.Read
Do Until input = -1
sb.Append(ChrW(input))
input = sr.Read
Loop
Return SB.tostring
///

I hope this helps?

Cor

"James D. Marshall" <cr**********@hotmail.com>
Please point me to some articles that explain how to execute a dos type
command and retrieve its output for processing.
Thanks.


Nov 22 '05 #3

P: n/a
James,

Parsing can mean a lot in dotNet, so maybe better that you make a new
message, in this newsgroup or in the newsgroup I pointed you on. The last in
my idea better because VBNet has a lot of extra conversion functions which
make parsing easier. And as written by the VBNet development team better.

Cor

"James D. Marshall" <cr**********@hotmail.com>
Thank you that does help a lot.
One question on parsing, the line has double carriage returns that show up
as squares, I am seeing this through watch1, how would you code a replace
statement to get rid of these, its driving me batty.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:uc**************@TK2MSFTNGP15.phx.gbl...
James,

Here beneath a simple sample, however did you know that there was a
special newsgroup for VB.net language
microsoft.public.dotnet.languages.vb

\\\
Public sub myStart() as String
Dim p As New Process
dim pi as new processstartinfo
pi.UseShellExecute = False
pi.RedirectStandardOutput = True
pi.Arguments = myargumentstring
pi.WorkingDirectory = myworkdirectorystring
pi..FileName =C:\myprogram
pi.startinfo = pi
p.Start()
Dim sr As IO.StreamReader = p.StandardOutput
Dim sb As New System.Text.StringBuilder("")
Dim input As Integer = sr.Read
Do Until input = -1
sb.Append(ChrW(input))
input = sr.Read
Loop
Return SB.tostring
///

I hope this helps?

Cor

"James D. Marshall" <cr**********@hotmail.com>
Please point me to some articles that explain how to execute a dos type
command and retrieve its output for processing.
Thanks.



Nov 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.