将命令行变量传递到基于WiXx的Windows Installer MSI中 [英] Pass command line variables into WiXx based Windows Installer MSI
问题描述
我正在使用WiX构建MSI安装程序,并且正在使用 WixUI_Advanced
。我的 ApplicationFolder
的定义类似于另一个SO答案中的建议( WiX技巧和窍门)。
I am building an MSI installer with WiX and I am using the WixUI_Advanced
. The definition of my ApplicationFolder
looks like this, following the advice in another SO answer (WiX tricks and tips).
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="APPLICATIONFOLDER" Name="$(var.InstallName)">
我现在想让用户选择执行静默安装并通过<$ c $路径上的c> ApplicationFolder 名称,相对于适当的程序文件文件夹,还是相对于绝对路径。
I now want to give the user the option to do a silent install and pass the ApplicationFolder
name on the path, either relative to the appropriate program files folder or absolute.
我知道我可以传递公共属性值在 msiexec,
的命令行上,但是如何将其用作 ApplicationFolder
的值,以及如何设置它
I know that I can pass public property values on the command-line of msiexec,
but how do I use that as value for ApplicationFolder
and how do I set this up for absolute vs relative paths.
推荐答案
您只需在运行msiexec时在命令行上定义属性:
You just define the property on the command line when running msiexec:
msiexec /i product.msi APPLICATIONFOLDER="C:\Program Files\Company\Product\"
文件将安装到 C:\Program Files\Company\Product目录中。
The files will be installed into "C:\Program Files\Company\Product" directory.
我建议在这里使用绝对路径。相对路径可能会导致意外结果。
I'd advice using absolute path here. A relative path may lead to unexpected results.
这篇关于将命令行变量传递到基于WiXx的Windows Installer MSI中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!