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!

How to handle Multiple Command Line arguments in VB ?

Status
Not open for further replies.

VBQuery

Programmer
Apr 2, 2001
14
US
Hi Guys
I have a requirement that I have to accept multiple command line arguments in VB. Each argument has more than one predefined value.
For example lets say parameters are X and Y.
X can be 1 or 2 or 3. If no argument is specified default is "1".
Y can be A , B or C. If no argument is specified default is "A".
So this requires to validate the arguments after accepting them from command prompt.
I am new to VB, can you guys please let me know how do I start on this.

Thanks
 
Your can use the COMMAND() function, which returns a string, containing all of the user-supplied values as a single string. Then you will have to parse it and set the default values as needed yourself.

VB will help you in parsing with Split function, which will get a string with delimiter (say ","), and put each item in an element of an array. Refer to MSDN for more info.


Mohammad Mehran Nikoo, MCP
mohmehran@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top