Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accepting command line parameters

Status
Not open for further replies.

shultz

Programmer
Oct 28, 2001
42
HK
how can I pass parameters to an executable file. I have a programme which generates a chart depending on the date entered by the user. Now my need is that I should pass it as a parameter. Is it possible to pass it as a parameter. And after that how can I catch that parameter in the programme.

Any supporting code would be appreciated.

thanks.
 
You want to use the Command function - here's what the docs have to say on it...
*******************************
Command Function


Returns theargument portion of thecommand line used to launch Microsoft Visual Basic or an executable program developed with Visual Basic.

Syntax

Command

Remarks

When Visual Basic is launched from the command line, any portion of the command line that follows /cmd is passed to the program as the command-line argument. In the following example, cmdlineargs represents the argument information returned by the Command function.

VB /cmd cmdlineargs
For applications developed with Visual Basic and compiled to an .exe file, Command returns any arguments that appear after the name of the application on the command line. For example:

MyApp cmdlineargs
To find how command line arguments can be changed in the user interface of the application you're using, search Help for "command line arguments."
****************

If you need to split the command line into a numer of seperate arguments, I can email you a class that I wrote which does it all for you... Let me know if you want it, my email is martin.milan@orange.net

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top