-
I am using Visual Basic 4.0 to create executable CGI scripts, which despite the dated technology, works well. In order to streamline the number of executable files that are neccessary, it seems like a good idea to pass command line arguments to each program.
As an example, I collect data, and then proceed from compiled CGI Data1.exe to Data2.exe.
Instead, it seems like a great idea :) to call a Data.exe, followed by some parameter, hence: Data.exe 1, or Data.exe 2.
Using VB4.0, how do I pass parameters in this way? Does anyone know?
Thanks!
Shaun
-
All command Line parameters are stored in the String 'Command$' So, just parse it up! :)
-
Thanks MrShickadance.
I guess I am truly a novice. Must I first declare this string, or can it be automatically referenced and stored into a string variable?
Thanks!
[Edited by stonstad on 05-23-2000 at 03:42 PM]
-
Nope, it's already defined for you to use. It has to be. Command line args will always be in the Command$ variable.
-
Wow, I'd really love for this to work. For some reason though, my cgi prints out the following when I convert $Command to a string and output it:
"d:\WEBSITE\CGI-TEMP\285WS.INI"
Any ideas?
-
Nono, the variable "Command$" is the variable name, not "Command" It is already a string, no need to convert.
so, something like this will work:
Code:
Public Sub Main()
Dim c_list() As String
Dim i As Integer
'' command line args, space delim.
c_list = Split(Command$, " ")
'' display all command line args
For i = LBound(c_list) To UBound(c_list)
Call MsgBox(c_list(i))
Next i
End Sub