Shell and Proceses.Start

  • Thread starter Thread starter Charles A. Lackman
  • Start date Start date
C

Charles A. Lackman

Hello,

When I use Shell in VB.NET all works great. i.e.

Shell("C:\Hogg.exe -n -pg")

but when I use Dim MyProcess as Process =
System.Diagnostics.Process.Start("C:\Hogg.exe -n -pg")

I get an error that says it cannot find the file.

I need more control over the 'Shelled Application' than just shell because
sometimes it is already running and throughs an exception that I need to
catch. The problem seems to be in the use of switches. If I remove the
switches it works but the application requires them. Augh..

Any suggestions would be greatly appreciated.

Thanks,
Chuck
 
Use the ProcessInfo class (instead of a string) in the Start method.
You can set the ProcessInfo.Arguments property with the switches.

-Rob Teixeira [MVP]
 
Back
Top