Perfect, thanks... I have created a function if anyone is interested
(watch for line breaks)...
Friend Function ReadCmdOutput(ByVal applicationName As String,
Optional ByVal applicationArgs As String = "", Optional ByVal
workingDirectory As String = "", Optional ByVal showWindow As Boolean
= False) As String
Try
Dim processObj As New Process
processObj.StartInfo.UseShellExecute = False
processObj.StartInfo.RedirectStandardOutput = True
processObj.StartInfo.FileName = applicationName
processObj.StartInfo.Arguments = applicationArgs
processObj.StartInfo.WorkingDirectory = workingDirectory
If showWindow = True Then
processObj.StartInfo.CreateNoWindow = False
Else
processObj.StartInfo.CreateNoWindow = True
End If
processObj.Start()
processObj.WaitForExit()
Return processObj.StandardOutput.ReadToEnd
Catch ex As Exception
Return ""
End Try
End Function
"Cor Ligthert" <no**********@planet.nl> wrote in message news:<eR**************@tk2msftngp13.phx.gbl>...
Hi Steve,
Roughly copied from a program and changed
I hope this helps?
Cor
\\\
Dim p As New Process
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.Arguments = myargumentstring
p.StartInfo.WorkingDirectory = myworkdirectorystring
p.StartInfo.FileName =C:\myprogram
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
///