Shell.Run带参数

时间:2013-07-10 09:04:45

标签: vbscript arguments quotes

我正在尝试使用来自VBS的/config运行程序(带参数Shell.Run)。但是我的退出代码= 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

0 个答案:

没有答案