Process output redirection?

M

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.
 
G

Guest

"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"
 
M

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top