使用PowerShell运行msiexec


10

我尝试msiexec在PowerShell中运行,但始终收到错误消息。如果我从那cmd开始运行,那一切都很好。

有人可以让我知道如何在PowerShell中运行此命令吗?

这是我在PowerShell中键入的命令:

msiexec.exe /qb /I "C:\m_temp\Floating\PrimeWixInstaller.msi" INSTALLLOCATION="C:\Program Files\Mathcad\Mathcad Prime 1.0" ALT_DOC_DIR="C:\Program Files\Mathcad\Mathcad Prime 1.0"

当我尝试运行命令时,将弹出Windows Installer帮助窗口:

Windows Installer帮助窗口

Answers:


7

发生这种情况是因为参数包含空格(例如"C:\Program Files\Mathcad\Mathcad Prime 1.0")。在这种情况下,您必须对参数周围的引号进行转义。

PowerShell中的转义字符是grave-accent(`)。

因此,命令应如下所示:

msiexec.exe /qb /I "C:\myInstaller.msi" INSTALLLOCATION=`"C:\Program Files\installFolder`" ALT_DOC_DIR=`"C:\Program Files\otherFolder`"
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.