Vbscript 带参数运行

Vbscript 带参数运行,vbscript,arguments,quotes,Vbscript,Arguments,Quotes,我正在尝试使用Shell.run从VBS运行程序(参数为/config)。但是,我的退出代码为87(找不到指定的文件) 我试过的第一段代码: strCommand = """c:\Program Files\Test\launch.exe""" & " /config:C:\sample.xml" intExit = objShell.Run(strCommand, 0, True) 第二段代码: Dim FileExe, Argum FileExe = "%ProgramFiles%

我正在尝试使用
Shell.run
从VBS运行程序(参数为
/config
)。但是,我的退出代码为87(找不到指定的文件)

我试过的第一段代码:

strCommand = """c:\Program Files\Test\launch.exe""" & " /config:C:\sample.xml"
intExit = objShell.Run(strCommand, 0, True)
第二段代码:

Dim FileExe, Argum
FileExe = "%ProgramFiles%\Test\launch.exe"
Argum = "/config:C:\sample.xml"

RunMe FileExe, Argum

Function RunMe(FileExe, Argum)
    Dim Titre, ws, Command, Exec
    Titre = "Execution avec argument"
    Set ws = CreateObject("WScript.Shell")
    command = "cmd /c "& qq(FileExe) & " " & Argum &" "
    Msgbox command, 64, Titre
    Exec = ws.Run(command, 0, True)
End Function

Function qq(str)
    qq = chr(34)& str &chr(34)
End Function

试试这个-这些引语在我看来还行。此外,如果找不到可执行文件,脚本将以错误80070002终止。
Run
方法不应该返回任何内容。您是否确保
C:\sample.xml
存在?只是为了检查,您故意隐藏了程序,对吗?参数中的0使窗口不可见。我会首先尝试将它设置为1,在那里它将是可见的,并且只有在您确定它有效时才将它更改为0。这也可能使您可以看到任何错误。(刚刚意识到这是一个老问题。)