应用程序exe后带参数,vb程序怎样得到参数值?
比如:
test.exe install
我知道delph i 用ParamStr函数可以得到。
ParamStr returns a specified parameter from the command-line.
问题点数:20、回复次数:3Top
1 楼sunxl(小呆)回复于 2002-05-31 15:49:15 得分 0
土耳其队遭遇恐怖袭击!
巴西队集体拉肚子!
中国队和哥斯达黎加携手迈进十六强。
Private Sub Form_Load()
MsgBox Command$
End Sub
如果你有什么疑问 请给我留言 :)
http://www.csdn.net/Message_Board/Send.asp?sendto=sunxlTop
2 楼funboy88(司令)回复于 2002-05-31 15:52:48 得分 0
Dim cmd As String
cmd = UCase(Command)
这样就可以啦
command中就是命令参数
直接用就是啦,相当于函数Top
3 楼hailang_zh(我是一个小兵)回复于 2002-05-31 16:04:23 得分 20
Command 函数示例
Function GetCommandLine(Optional MaxArgs)
'声明变量。
Dim C, CmdLine, CmdLnLen, InArg, I, NumArgs
'检查是否提供了 MaxArgs 参数。
If IsMissing(MaxArgs) Then MaxArgs = 10
' 使数组的大小合适。
ReDim ArgArray(MaxArgs)
NumArgs = 0: InArg = False
'取得命令行参数。
CmdLine = Command()
CmdLnLen = Len(CmdLine)
'以一次一个字符的方式取出命令行参数。
For I = 1 To CmdLnLen
C = Mid(CmdLine, I, 1)
'检测是否为 space 或 tab。
If (C <> " " And C <> vbTab) Then
'若既不是 space 键,也不是 tab 键,
'则检测是否为参数内含之字符。
If Not InArg Then
'新的参数。
'检测参数是否过多。
If NumArgs = MaxArgs Then Exit For
NumArgs = NumArgs + 1
InArg = True
End If
'将字符连接到当前参数中。
ArgArray(NumArgs) = ArgArray(NumArgs) & C
Else
'找到 space 或 tab。
'将 InArg 标志设置成 False。
InArg = False
End If
Next I
'调整数组大小使其刚好符合参数个数。
ReDim Preserve ArgArray(NumArgs)
'将数组返回。
GetCommandLine = ArgArray()
End FunctionTop




