Running dos command in VB
Hi
I am very new to VB .net 2003 and want to know how should I run dos commands with arguments in VB and redirect its output to a file.
Also, would like to know if there is a way to parse the output given by the dos command bcoz I need to use the result obtained by the dos command in later.
Please help.
Thanks in advance
[354 byte] By [
neelneelu] at [2007-11-11 10:09:42]

# 1 Re: Running dos command in VB
Dim psi As New System.Diagnostics.ProcessStartInfo("d:\path\filename.exe", "arg1 arg2")
With psi
.UseShellExecute = False
.ErrorDialog = False
.CreateNoWindow = True
.RedirectStandardOutput = True
End With
Dim p As Process = System.Diagnostics.Process.Start(psi)
Dim sr As System.IO.StreamReader = p.StandardOutput
Dim output As String = sr.ReadToEnd()
sr.Close()
The spawned app's output is now in the variable named "output."