Launch a program with command line arguments

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!
 
T

Tom Shelton

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"
 

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