If not wrong the double quote in VB is equavalen to Chr$(34), so you can do it like this:
param1 = Chr$(34) & "1" & Chr$(34)
param2 = Chr$(34) & "2" & Chr$(34)
param3 = Chr$(34) & "3" & Chr$(34)
param4 = Chr$(34) & "4" & Chr$(34)
Shell "c:\test.exe " & param1 & " " & param2 & " " & param3 & " " & param4
Then you can use the CommandLine function as mentioned above.
Example, in the test.exe's Form Load Event:
Private Sub Form_Load()
Dim tmp As String, tmpArr() As String
tmp = Commandline
If tmp <> "" Then
Erase tmpArr
tmpArr = Split(tmp," ")
End If
'Then here try to get compare the value like:
If UBound(tmpArr) = 3 Then
txtA = tmpArr(0)
txtB = tmpArr(0)
txtC = tmpArr(0)
txtD = tmpArr(0)
End if
'Or do whatever according to the CommandLine/Argument values.
End Sub
Hope this helps too.
regards
Main Topics
Browse All Topics





by: Richie_SimonettiPosted on 2002-08-27 at 21:47:22ID: 7245668
you could check for Command$ statement:
al MaxArgs)
for_load() ' or sub main
if command$<>"" then
'process command line parameters
end if
here is an example from MSDN:
Function ObtenerLíneaComando(Option
'Declara las variables.
Dim C, LíneaComando, LonLínComando, ArgIn, I, NúmArgs
'Ver si MaxArgs está.
If IsMissing(MaxArgs) Then MaxArgs = 10
'Crea una matriz del tamaño correcto.
ReDim ArgArray(MaxArgs)
NúmArgs = 0: ArgIn = False
'Obtiene los argumentos de la línea de comandos.
LíneaComando = Command()
LonLínComando = Len(LíneaComando)
'Recorre la línea de comando carácter a carácter
'a la vez.
For I = 1 To LonLínComando
C = Mid(LínComando, I, 1)
'Comprueba espacio o tabulación.
If (C <> " " And C <> vbTab) Then
'Ningún espacio o tabulación.
'Comprueba si está en el argumento.
If Not ArgIn Then
'Empieza el nuevo argumento.
'Comprueba para más argumentos.
If NúmArgs = MaxArgs Then Exit For
NúmArgs = NúmArgs + 1
ArgIn = True
End If
'Concatenar el carácter al argumento actual.
ArgArray(NúmArgs) = ArgArray(NúmArgs) & C
Else
'Encontró un espacio o tabulador.
'Establece ArgIn a False.
ArgIn = False
End If
Next I
'Redimensiona la matriz lo suficiente para contener los argumentos.
ReDim Preserve ArgArray(NúmArgs)
'Devuelve la matriz en nombre de la función.
ObtenerLíneaComando = ArgArray()
End Function