I
iforsyth
Hi.
Running an app with System.Diagnostics.Process process with:
Sample code:
myproc = New System.Diagnostics.Process()
strPgm = "myapp.exe"
strArgs = ""
myproc.StartInfo = New
System.Diagnostics.ProcessStartInfo(strPgm, strArgs)
myproc.Start()
myproc.WaitForExit()
myproc.Close()
At points in the application, I write standard out to a file, i.e.:
Dim objLogFS As FileStream = New
FileStream(System.AppDomain.CurrentDomain.BaseDirectory() & "/Log/" &
Format(Now(), "yyyyMMddhhmmss") & ".txt", FileMode.Create)
Dim objLogStreamWriter As StreamWriter = New
StreamWriter(objLogFS)
Console.SetOut(objLogStreamWriter)
Console.WriteLine(vbCrLf & "***Application Ended At " & Now())
But this only captures output within the main application, not the
standard output that's being generated by the process. How do I get
the output from myproc and write it to a file?
Ian
Running an app with System.Diagnostics.Process process with:
Sample code:
myproc = New System.Diagnostics.Process()
strPgm = "myapp.exe"
strArgs = ""
myproc.StartInfo = New
System.Diagnostics.ProcessStartInfo(strPgm, strArgs)
myproc.Start()
myproc.WaitForExit()
myproc.Close()
At points in the application, I write standard out to a file, i.e.:
Dim objLogFS As FileStream = New
FileStream(System.AppDomain.CurrentDomain.BaseDirectory() & "/Log/" &
Format(Now(), "yyyyMMddhhmmss") & ".txt", FileMode.Create)
Dim objLogStreamWriter As StreamWriter = New
StreamWriter(objLogFS)
Console.SetOut(objLogStreamWriter)
Console.WriteLine(vbCrLf & "***Application Ended At " & Now())
But this only captures output within the main application, not the
standard output that's being generated by the process. How do I get
the output from myproc and write it to a file?
Ian