通过vbscript传递msiexec开关

通过vbscript传递msiexec开关,vbscript,windows-installer,silent-installer,Vbscript,Windows Installer,Silent Installer,我试图通过VBScript悄悄地安装MSI包,但是当我尝试通过所有我获得的开关是空白命令提示符和Windows安装程序工具提示打开。< /P> 下面是我尝试过的几种方法,但每次都得到相同的结果 我第二次尝试 Dim objShell Set objShell = WScript.CreateObject( "WScript.Shell" ) objShell.Run("""%userprofile%\Desktop\Deployment\AppleApplicationSupport64.ms

我试图通过VBScript悄悄地安装MSI包,但是当我尝试通过所有我获得的开关是空白命令提示符和Windows安装程序工具提示打开。< /P> 下面是我尝试过的几种方法,但每次都得到相同的结果

我第二次尝试

Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("""%userprofile%\Desktop\Deployment\AppleApplicationSupport64.msi""") + "/quiet" + "/norestart"
objShell.Run("""%userprofile%\Desktop\Deployment\AppleMobileDeviceSupport6464.msi""") + "/quiet" + "/norestart"
objShell.Run("""%userprofile%\Desktop\Deployment\iTunes6464.msi""") + "/quiet" + "/norestart"
objShell.Run("""%userprofile%\Desktop\Deployment\Bonjour64.msi""") + "/quiet" + "/norestart"
objShell.Run("""%userprofile%\Desktop\Deployment\AppleSoftwareUpdate.msi""") + "/quiet" + "/norestart"
Set objShell = Nothing

它似乎没有超过msiexec命令。如何让它运行整个字符串和完整的命令来安装软件包?

看起来您发送到shell的命令中缺少了一些空格。我将仅检查第一个命令作为示例。以下是你写的:

objShell.Run "cmd /c msiexec" & "/i" & Chr(34) & "AppleApplicationSupport64.msi" & Chr(34) & "/quiet" & "/norestart"
下面是该语句生成的命令:

msiexec/i"AppleApplicationSupport64.msi"/quiet/norestart
您得到的是
Windows Installer
窗口,因为它不理解没有空格的命令。相反,在字符串中添加一些空格,如下所示:

   objShell.Run "cmd /c msiexec " & "/i " & Chr(34) & "AppleApplicationSupport64.msi" & Chr(34) & " /quiet" & " /norestart"
上述命令的格式如下:

msiexec/i“AppleApplicationSupport64.msi”/quiet/norestart


这应该可以解决您的问题。

我认为msi交换机之间需要一个空间
()
   objShell.Run "cmd /c msiexec " & "/i " & Chr(34) & "AppleApplicationSupport64.msi" & Chr(34) & " /quiet" & " /norestart"