parameter at the begining ot applicaton


Author
Message
Eric Leissler
Eric Leissler
StrataFrame User (321 reputation)StrataFrame User (321 reputation)StrataFrame User (321 reputation)StrataFrame User (321 reputation)StrataFrame User (321 reputation)StrataFrame User (321 reputation)StrataFrame User (321 reputation)StrataFrame User (321 reputation)StrataFrame User (321 reputation)
Group: StrataFrame Users
Posts: 0, Visits: 527
Hi,

I just want to launch my application wiht some parameters

like monappli.exe /param1 /param2

How can i do that ?

thanks

Best regards

Eric
Reply
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Sure, using parameters is a great idea to add in automated features into an executable.  This is something that I do regularly, but depending on your approach, can be a little work.  I like to create a command line class that can parse the inbound parameters.

To begin, start with the AppMain.vb or program.cs (if you are using an SF project).  Otherwise, just go to your main program entry point.

You can then call the GetCommandLineArgs() if you are running in a WinForms environment.  If you are running in a console app environment, the args will be passed in through the Main entry point as a parameter.

Environment.GetCommandLineArgs()


Next, you can pass these args into a parser that lines up with your desired command line logic.  I will generally write RegEx methods to parse the command line based on what I am expecting coming in and then place that into a collection that has the name and value. 

Hope this helps get you started.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search