shell
-or
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _ 
 ByVal hwnd As Long, _ 
 ByVal lpOperation As String, _ 
 ByVal lpFile As String, _ 
 ByVal lpParameters As String, _ 
 ByVal lpDirectory As String, _ 
 ByVal nShowCmd As Long) As Long

解决方案 »

  1.   

    你說的是Command吧,直接這樣:
    sub main()
    msgbox command
    end sub
      

  2.   

    这个notpad.exe
    好像写错了
    应该是
    notepad.exe
      

  3.   

    shell "notepad.exe www.txt"
    给分吧
      

  4.   

    楼主的说的是命令行参数的使用方法,楼主应该是想编一个类似“windows记事本”的工具,因此命名为“notpad", 同时希望带上参数,如“www.txt”,因此就是应该使用VB的内置的Command参数,在“工程属性”的“生成”项中就有“命令行参数(C)”可填,这里是实现默认参数的设置,当运行程序时没有外带参数时,则使用该默认参数。具体用法如下(可带多参数——用分隔符):
    Private Sub Form_Load()
    Dim strA() As String
        strA = Split(Command, ",")  '这里的 , 就是分隔符,可以用"/" 、" "等代替
        If UBound(strA) = -1 Then GoTo DoNoCommand
        For i = 0 To UBound(strA)   '带参数时的处理(包括带默认参数)
            MsgBox "第" & (i + 1) & "个参数是" & strA(i)号 
        Next i
        Exit Sub
    DoNoCommand:
        MsgBox "没有参数"  '不带参数时的处理(包括不带默认参数)
    End Sub
      

  5.   

    注意在strA()中的不能填值,这是一个个数可变的字符型数组。
      

  6.   

    Command 函数示例
    本示例在某个函数中用 Command 函数获得命令行参数,并将命令行参数以 Variant 类型之数组返回。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 Function