我试图通过vbscript静默安装MSI包,但当我尝试通过所有我得到的切换时,空白命令提示符和Windows Installer工具提示打开 .
以下是我在下面尝试过的几种方法,但每次都会得到同样的结果 .
Dim objShell
Set objShell = Wscript.CreateObject ("Wscript.Shell")
objShell.Run "cmd /c msiexec" & "/i" & Chr(34) & "AppleApplicationSupport64.msi" & Chr(34) & "/quiet" & "/norestart"
objShell.Run "cmd /c msiexec" & "/i" & Chr(34) & "AppleMobileDeviceSupport6464.msi" & Chr(34) & "/quiet" & "/norestart"
objShell.Run "cmd /c msiexec" & "/i" & Chr(34) & "iTunes6464.msi" & Chr(34) & "/quiet" & "/norestart"
objShell.Run "cmd /c msiexec" & "/i" & Chr(34) & "Bonjour64.msi" & Chr(34) & "/quiet" & "/norestart"
objShell.Run "cmd /c msiexec" & "/i" & Chr(34) & "AppleSoftwareUpdate.msi" & Chr(34) & "/quiet" & "/norestart"
Set objShell = Nothing
第二种方式我试过
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命令 . 如何让整个字符串一起运行整个命令来安装软件包?
1 回答
看起来您在命令中缺少一些要发送到shell的空格 . 我将以第一个命令为例进行检查 . 这是你写的:
这是该语句构建的命令:
您正在获取
Windows Installer
窗口,因为它不理解没有空格的命令 . 相反,在字符串中添加一些空格,如下所示:以上将命令格式为:
msiexec /i "AppleApplicationSupport64.msi" /quiet /norestart
这应该可以解决您的问题 .