4

I install my application to a specific folder using the below 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 to be given from the command line like below:

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

Thanks a lot.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
Dundar
  • 1,311
  • 1
  • 14
  • 25

2 Answers2

4
<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 install:

msiexec /I setup.msi INSTALLLOCATION=C:\Somewhere /qn
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • @Glytzhkof: You know, it's so sad that you have to do that. You are right... there are probably a lot of lazy setup developers who don't have a clue that would copy and paste that GUID. – Christopher Painter Jun 18 '14 at 00:41
  • Many beginners seem to not be up to speed on the GUID concept, and using auto-generation solves the issue I think. – Stein Åsmul Jun 18 '14 at 15:42
  • Most installshield / wix developers aren't up to speed with a great deal of the underlying MSI tech. I was only trying to answer the question that was asked. – Christopher Painter Jun 18 '14 at 15:56
1

I am adding as an answer to get proper links. You should check out Wix's auto-generate GUID feature: WIX Autogenerate GUID *?

This feature allows you to stop generating your own GUIDs and have Wix take care of them in an "automagic" way. I haven't tested it, but anything that makes your source file cleaner, shorter, and easier to maintain is worth trying. It also makes it easier to share Wix snippets without people reusing your generated GUID.

Maybe also check out:

And one more thing with regards to properties. In general all PUBLIC properties (uppercase) can be set on the command line. If you want to use these properties in deferred mode custom actions you need to check out the concept of restricted public properties and the SecureCustomProperties property. Some Installshield info too. And a nice old Wise article.

Community
  • 1
  • 1
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164