Microsoft Installer 命令行字符串参数不起作用?

Microsoft Installer command line string parameter not working?

所以我正在尝试 运行 使用我的 msi 进行完全安装,似乎我可以轻松地为我拥有的参数传递一个数字,但我似乎无法传递一个字符串...我尝试使用单引号 ' 和双引号 "

msiexec /i 'My Installer.msi' /quiet JREPATH="c:\BLA BLA"

This 和单引号 return this :

现在根据这篇文章:https://docs.microsoft.com/en-us/windows/desktop/msi/command-line-options

它应该可以工作...

Property values that are literal strings must be enclosed in quotation marks. Include any white spaces in the string between the marks.

msiexec /i A:\Example.msi PROPERTY="Embedded White Space"

MSI 没有问题,我假设这是因为如果我传递一个数字..它有效...

msiexec /i 'My Installer.msi' /quiet JREPATH=3

后期编辑:

当我在参数值中有一个 space 时,问题似乎出现了。例如,像下面的例子一样有效:

msiexec /i "WKFS ReportGenerator.msi" /quiet JREPATH="c:\;;BLA"

但这不是:

msiexec /i "WKFS ReportGenerator.msi" /quiet JREPATH="c:\;;BLA a"

后期编辑 2:

如果使用简单的 cmd 而不是 PowerShell,这些命令在值 work 中包括 spaces..

UPDATE: Since this was related to PowerShell. See Windows Installer PowerShell Module on github.com (scroll down for description, use releases tab for download). I haven't really tested it much, but it is from Heath Stewart - Microsoft Senior Software Engineer (github).

Brief, inline sample:

install-msiproduct .\example.msi -destination (join-path $env:ProgramFiles Example)

下面是在我意识到这与PowerShell有关之前写的.


快速建议:也许试试这个命令行:

msiexec.exe /i c:\setup.msi /QN /L*V "C:\Temp\msilog.log" JREPATH="c:\MyPath"

去掉你指定路径中的双\(可能就够了),并使用旧样式/QN 开关而不是 /quiet 开关。下面是一些阐述和细节。


静默安装:这是什么安装程序?它是供应商包吗?我想是某种 Java 应用程序?这是 install a normal MSI file silently:

msiexec.exe /i c:\setup.msi /QN /L*V "C:\Temp\msilog.log"

快速解释:

/L*V "C:\Temp\msilog.log"= verbose logging
/QN = run completely silently
/i = run install sequence

msiexec.exemsiexec.exe[=有两种开关71=] - 老式的,例如 /QN (Command-Line Options) for silent installation which matches the newer /quiet that you are using (Standard Installer Command-Line Options).

要像以前一样添加属性,请将其添加到命令行:

msiexec.exe /i myinstaller.msi ADDLOCAL="Program,Dictionaries" SERIALKEY="1234-1234" /qn

一些进一步的链接:

  • How to make better use of MSI files(关于如何在应用或不应用转换的情况下静默部署 MSI 文件。仅第一部分。最后一部分详细介绍了其他主题)
  • Batch script to install MSI(相似答案)

如果您从 Powershell 调用,您应该使用调用运算符 & 然后这也应该使用引号括起来的参数:

& msiexec /i `"My Installer.msi`" /quiet JREPATH=`"c:\BLA BLA`"