[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 361
  • Last Modified:

Command Line Parameters in VB5

How can I process command line parameters in VB5?
0
lankford
Asked:
lankford
  • 2
1 Solution
 
dirtdartCommented:
In your startup Subroutine (Sub Main or Form_Load) you need to process the built in variable Command or Command$ (either one does the same thing).  This will pass all the command line parameters entered when that program started into the program.
0
 
dirtdartCommented:
Oops.  I guess I should tell you that it's just a string variable, so you can treat it like any other string variable.  For example, if you're expecting a Command line parameter of "jrf" then you can do this:

If Command = "jrf" Then
 'Do whatever....
End if


You can use multipule command line parameters by separating them with a comma (or whatever else you want, just as long as you remember what it is).  Just like this:

Dim x As Integer
Dim cmdOne As String
Dim cndTwo As String

x = InStr(Command, ",")
cmdOne = Left(Command, x - 1)
cmdTwo = Right(Command, x)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now