雨树侠 2007-11-22 10:20
如何在VB中使用命令行参数
Option Explicit
** Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineA" () As String ** Declare Function GetCurrentTime Lib "kernel32" Alias "GetTickCount" () As Long **
Sub Form_Load()
Text1.Text = GetCommandLine() '法一:返回值中带有,应用程序本身的全路径。
Text2.Text = Command '法二:返回值中只有所传的参数。
End Sub
如:应用程序为:D:\VB\TEST.EXE 在命令行执行:test param1
则:Text1.text="D:\VB\TEST.EXE" param1
而:Text2.text=param1