|
|
Title | List a program's command-line arguments |
Keywords | list, command line, command, arguments |
Categories | Tips 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
|
|
|
|
|
|