Launch a program with command line arguments

  • Thread starter Thread starter Juan Romero
  • Start date Start date
J

Juan Romero

Hey guys,

I need to launch an external application, but I need to launch it with some
command line arguments. Now the thing is that I need to launch it as a
process. For example:

Dim p As New System.Diagnostics.Process
Dim s As New System.Diagnostics.ProcessStartInfo("C:\My Path\MyFile.exe")
Try
s.UseShellExecute = True
s.WindowStyle = ProcessWindowStyle.Normal
p.StartInfo = s
p.Start()
Catch ex As Exception
HandleError(ex)
End Try
p = Nothing
s = Nothing

This will cause the operating system to launch the file with the default
handler program, but it gives me an error because of the command line
arguments.

Any ideas on how to accomplish this?

Thanks!
 
Hey guys,

I need to launch an external application, but I need to launch it with some
command line arguments. Now the thing is that I need to launch it as a
process. For example:

Dim p As New System.Diagnostics.Process
Dim s As New System.Diagnostics.ProcessStartInfo("C:\My Path\MyFile.exe")
Try
s.UseShellExecute = True
s.WindowStyle = ProcessWindowStyle.Normal

' set the command line
s.Arguments = "CommandLine Arguments"
 
Back
Top