Results 1 to 4 of 4

Thread: Executable options

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Posts
    161

    Question

    I am trying to create an application the would respond to 'switches'. At run time if I run: 'MyApp /a' would execute something different from 'MyApp /b'.

    Obviously, this can be done (an please forgive my lack of technical terms...), but I have no idea how.

    Anybody knows ?

    Thanks.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    If you use the Command function it will return all arguments passed to the application.
    Code:
    Private Sub Form_Load()
        Select Case LCase$(Command)
            Case "/a"
                'do whatever
            Case "/b"
                'do something else
        End Select
    End Sub
    Good luck!

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    That works until the end-user puts too many arguments on. You need to use Split() on Command, so that you get a list of all the arguments.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 1999
    Posts
    161

    Cool

    It works great ! Thanks...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width