Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleList a program's command-line arguments
Keywordslist, command line, command, arguments
CategoriesTips and Tricks, Windows
 
Use the Command$ function.

When you start a program by dragging files onto it in Windows Explorer or onto a shortcut to the program, the files are listed by the Command$ function.

Instructions:

Build the program into an executable. Then drag files onto the exe file in Windows Explorer.

 
Private Sub Form_Load()
    ' Display the command line parameters.
    parameters = Command$
    Do While Len(parameters) > 0
        pos = InStr(parameters, " ")
        If pos = 0 Then
            new_parameter = parameters
            parameters = ""
        Else
            new_parameter = Left$(parameters, pos - 1)
            parameters = Mid$(parameters, pos + 1)
        End If
        txt = txt & new_parameter & vbCrLf
    Loop

    Text1.Text = txt
End Sub
 
Formatted by Neil Crosby
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated