请各位大侠帮忙通过VB编译的EXE文件,如果在DOS状态下运行的时候再参数运行相应的功能?也就是说如果在DOS状态下,运行程序的时候将参数传进去??急急急?

解决方案 »

  1.   

    Dim strCommand As String
    strCommand = Command()
    If strCommand = "-debug" Then
        bDebugRun = True
    Else
        bDebugRun = False
    End If输入程序.EXE -debug
    接收到参数后,设置Debug状态(bDebugRun为自设标志)
      

  2.   

    Private Sub Form_Load()
    MsgBox Command
    End Sub
    生成EXE
    '然后在"运行"中输入:
     你的程序.EXE 参数
    那个COMMAND就是你的参数了
      

  3.   

    Private Sub Form_Load()
    If Command = "sayhello" Then
        MsgBox "Hello World!"
    Else
        MsgBox "Go Hell!"
    End If
    End Sub
    然后编译成exe(c:\test.exe)
    然后打开dos窗口
    cd c:\
    test.exe sayhello
    test.exe other参数
      

  4.   

    vb中有一个系统自己带的全局变量叫command你写以下代码于模块中从sub main启动就明白了
    Sub main()
      MsgBox Command
    End Sub
    在命令控制台中输入工程1.exe AAA