Passing multiString values to installer through co

2019-06-14 13:55发布

问题:

I have an WiX installer configured like this:

<Property Id="MY_PROPERTY">

...

<Registry Name="MyValue" Type="multiString" Value="[MY_PROPERTY]" />

Now I want to pass this property value at the command line as a list:

MsiExec.exe /i MyInstaller.msi /qb MY_PROPERTY="One[~]Two[~]Three"

However, the installer does not split the values into a list and the literal value is written instead.

If I hard code the element it works properly:

<Registry Name="MyValue" Type="multiString" Value="One[~]Two[~]Three" />

Does anyone know how to specify a list of values at the command-line for a multiString registry value? Thanks in advance

回答1:

REG_MULTI_SZ

A sequence of null-terminated strings, terminated by an empty string (\0). The following is an example: String1\0String2\0String3\0LastString\0\0 The first \0 terminates the first string, the second to the last \0 terminates the last string, and the final \0 terminates the sequence. Note that the final terminator must be factored into the length of the string.

So as per this LINK you should be doing this:

MY_PROPERTY="One\0Two\0Three\0"

For MULTISTRINGValues check this element: MULTISTRINGVALUE