Installing to a Drive Other Than C:

Installing to a Drive Other Than C:
Anovatek TilakGovind's picture

If you have to install applications to any other Physical Drive (not network drive) you can do so in the following way.

default INSTALLDIR : C:\Program Files\Dir1

Change to D:\Program Files\Dir1

  1. In the MSI Script create a custom action In "User Interface" just after "Cost Finalize"

    "Set Directory" give it a Name, choose the directory by browsing to ProgramFilesFolder\Dir1 and in the third Blank Space enter "D:\Program Files\Dir1"

  2. Create the same Custom action in "Execute Immediate" just after "Cost Finalize" also

    This installation works fine as long as D: is a valid Drive, it does not work on drives that were created using "Subst.exe" Command.

3.487805
Average: 3.5 (41 votes)

There is also a ROOTDRIVE property

While this is an interesting approach, you should also consider using the Windows Installer ROOTDRIVE property. This can be overridden at the command line so it might be a bit easier to implement long term.

INSTALLDIR from command prompt

Harsh's picture

While installation you can change the Install directory. As INSTALLDIR is public property you can set it on command line, example
msiexec /i "path of MSINAME" INSTALLDIR="Directory Path"

This way you can install application in any drive & folder .
Following things need to be considered.
There should not be any hardcoding in any file or registry. If there is any hardcoding then it need to be resolve.
if "[ProgramFilesFolder]\ABC" is your InstallDir then wherver you find "[ProgramFilesFolder]\ABC" it should be replace with [INSTALLDIR] at every instance. Like in registry,ini file.

If there are any hardcode entry in uneditable file using wise (example config.xyz ) then it should be resolve by scripts.

And if any file is in cryptic format. i.e not uneditable at all then it is recommended not to change INSTALLDIR.

TARGETDIR also plays important role while, changing installdir. always recommended to check aliasing for it.

Regards
Harsh

Syndicate content