How to determine the installation folder from a command-line option in Wix installer

I install my application in a specific folder using the following wxs code:

<Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="INSTALLDIR" Name="CompanyName">
                <Directory Id="SUBDIR" Name="Application Launcher">
                    <Component Id="ApplicationFiles" Guid="*">
                        <File Name="app.exe" Id="AppFile1" Source="app.exe" Vital="yes" />
                    </Component>
                </Directory>
            </Directory>
        </Directory>
</Directory>

I want to specify the installation folder with a parameter that will be specified from the command line, as shown below:

msiexec.exe /i setup.msi PATH=C:\MyCompany\Folder\ /qn

Many thanks.

+4
source share
2 answers
<Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="CompanyFolder" Name="CompanyName">
                <Directory Id="INSTALLLOCATION" Name="Application Launcher">
                    <Component Id="ApplicationFiles" Guid="*">
                        <File Name="app.exe" Id="AppFile1" Source="app.exe" Vital="yes" />
                    </Component>
                </Directory>
            </Directory>
        </Directory>
</Directory>

For your installation:

msiexec /I setup.msi INSTALLLOCATION=C:\Somewhere /qn
+4
source

I am adding as an answer to get the correct links. Should you check the Wix Autogenerate GUID *?

GUID, Wix " ". , , , , . Wix GUID.

, :

. , PUBLIC ( ) . , SecureCustomProperties. Installshield info . Wise.

+1

Source: https://habr.com/ru/post/1544926/


All Articles