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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass command line options to VB app 1

Status
Not open for further replies.

RikHess

MIS
Jul 25, 2002
69
US
I would like to be able to pass "command line" options to a VB app. Can someone point me to info on how to do this?

TIA!
 
Well there is the Command keyword that returns the contents of the command line...

x = Command$
 
Suppose your app was invoked like this:
[tt]myapp.exe /c /N:foo /s[/tt]

Then if you do:
[tt]x = Command$[/tt]

So the value of x is "/c /N:foo /s"

So you could also use the Split() function to make this into an array, splitting on the empty spaces.
[tt]Dim x() As String
x = Split(Command$, " ")[/tt]
 
oh and if you want to test it in the development environment you can click the Project dropdown menu, pick your project's properties, and look on the "Make" tab for the textbox where you can put in command line arguments it will use when you run it in the IDE.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top