How do you pass parameters to a vb.net .exe?

jrunowski

Member
Joined
Aug 23, 2006
Messages
15
Programming Experience
Beginner
Hi,
I was wondering how you pass parameter's to a vb.net exe. My goal is to create a scheduled task that runs once a day and executes certain functions based on the parameters being passed to the exe. For example: If my program is called MyApp.exe and i have 2 Sub's called Start() and Stop(); i would want to be able to pass 2 parameters in the run path to execute start and stop. I think it would look something like this, "C:\MyApp.exe" /start /stop. Any Ideas?

- Jesse
 
Great thanks for the help that worked....i also found this as well.

Function GetCommandLineArgs() As String()
' Declare variables.
Dim separators As String = " "
Dim commands As String = Microsoft.VisualBasic.Command()
Dim args() As String = commands.Split(separators.ToCharArray)
MsgBox(args(0).ToString)
Return args
End Function
 
Ya that didnt work out the way i wanted it to; in fact i got some runtime errors when i started to add code. I ended up using the prior solution, thanks for all the help.
 
Back
Top