Home All Groups Group Topic Archive Search About

Process output redirection?

Author
24 Jan 2006 10:55 AM
mhmtzdmr
Hi,

I want to run an application and capture its output. But I receive the
error below in run-time.

"An unhandled exception of type 'System.ComponentModel.Win32Exception'
occurred in system.dll" Additional information: The system cannot find
the file specified




The sub is below.


RunApp("auunitref.exe", "-unit 95xx", "C:\Program Files\DA Manager
CLI")


   Public Sub RunApp(ByVal myprocess As String, ByVal param As String,
ByVal workingDir As String)
        Dim p As Process = New Process()
        Dim psi As New ProcessStartInfo()
        psi.FileName = myprocess
        psi.WorkingDirectory = workingDir
        psi.Arguments = param
        psi.UseShellExecute = False
        psi.CreateNoWindow = True
        psi.RedirectStandardOutput = True
        p.StartInfo = psi
        p.Start()
        Label3.Text = p.StandardOutput.ReadToEnd()
        p.WaitForExit()
    End Sub





Thanks and regards.

Author
24 Jan 2006 12:59 PM
AMercer
> "An unhandled exception of type 'System.ComponentModel.Win32Exception'
> occurred in system.dll" Additional information: The system cannot find
> the file specified

Probably "auunitref.exe" is not found in one of the directories in the PATH
environment variable.  Try a fully qualified filespec, or perhaps
  CurDir() & "\auunitref.exe"
Author
24 Jan 2006 2:04 PM
mhmtzdmr
Hi,

Thanks for your help. Yes the fully qualified path is working now.

RunApp("C:\Program Files\DA Manager CLI\auunitref.exe", "-unit 95xx",
"")

Regards.