By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,824 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,824 IT Pros & Developers. It's quick & easy.

Launch a program with command line arguments

P: n/a
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!
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <OA**************@TK2MSFTNGP09.phx.gbl>, Juan Romero wrote:
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"
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!

--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.