System Folder Properties |
Windows Installer defines some standard directory names which provide aliases to "special" folders. A list of these is provided below, for more generic Windows Installer information on any of these see the properties "System Folder Properties" page online.
Installing any MSI while generating a verbose log will create a text file which lists all available folder properties and their current values. You can use this to "prove" the value you believe you require.
You can use these values in "INI" files or "registry" etc by using a formatted value such as "[ProgramFilesFolder]" and note that the value always ends with a slash! If you don't want the slash you will need to write a custom action" to remove it.
The "DirectoryTree" and some other MAKEMSI commands allow you to specify directories and their parent directories (something Windows Installer doesn't do), so for example you could install into the directory "c:\program files\a\b\c\Install Here".
In general it is a bad idea to hard code something like "c:\program files" as Windows Installer defines the system folder property "ProgramFilesFolder" for this purpose. Please understand that "c:\program files" is only a default location which can be somewhere else on a different computer!
In actual fact with MAKEMSI's default configuration the hard coded value is "automatically mapped" to the correct system folder property (if you didn't want to do this you'd need to remove the mapping or work around it).
Example System Folder Properties |
Click on any of the properties below to see Microsoft's documentation for that directory property. Note that these properties were captured during a per-machine and per-user install (note that on this machine "D:\DBAREIS" is "My Documents").
System Folder Property |
PER-MACHINE 32 bit WinXP |
PER-USER 32 bit WinXP |
PER-MACHINE 64 bit Win7 |
PER-USER 64 bit Win7 |
---|---|---|---|---|
AdminToolsFolder | C:\Documents and Settings\All Users\Start Menu\Programs\Administrative Tools\ | C:\Documents and Settings\Dennis\Start Menu\Programs\Administrative Tools\ | C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\ | C:\Users\Dennis\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Administrative Tools\ |
AppDataFolder | As for per-user | C:\Documents and Settings\Dennis\Application Data\ | As for per-user | C:\Users\Dennis\AppData\Roaming\ |
CommonAppDataFolder | C:\Documents and Settings\All Users\Application Data\ | As for per-machine | C:\ProgramData\ | As for per-machine |
CommonFiles64Folder
(see "64 Bit Installs") |
no sample available | no sample available | C:\Program Files\Common Files\ | As for per-machine |
CommonFilesFolder | C:\Program Files\Common Files\ | As for per-machine | C:\Program Files (x86)\Common Files\ | As for per-machine |
DesktopFolder | C:\Documents and Settings\All Users\Desktop\ | C:\Documents and Settings\Dennis\Desktop\ | C:\Users\Public\Desktop\ | C:\Users\Dennis\Desktop\ |
FavoritesFolder | As for per-user | C:\Documents and Settings\Dennis\Favorites\ | As for per-user | D:\DBAREIS\[Favorites]\ |
FontsFolder | C:\WINDOWS\Fonts\ | As for per-machine | C:\Windows\Fonts\ | As for per-machine |
LocalAppDataFolder | As for per-user | C:\Documents and Settings\Dennis\Local Settings\Application Data\ | As for per-user | C:\Users\Dennis\AppData\Local\ |
MyPicturesFolder | As for per-user | D:\DBAREIS\My Pictures\ | As for per-user | D:\DBAREIS\[My Pictures]\ |
NetHoodFolder | As for per-user | C:\Documents and Settings\Dennis\NetHood\ | As for per-user | C:\Users\Dennis\AppData\Roaming\Microsoft\Windows\Network Shortcuts\ |
PersonalFolder | As for per-user | D:\DBAREIS\ | As for per-user | D:\DBAREIS\ |
PrintHoodFolder | As for per-user | C:\Documents and Settings\Dennis\PrintHood\ | As for per-user | C:\Users\Dennis\AppData\Roaming\Microsoft\Windows\Printer Shortcuts\ |
ProgramFiles64Folder
(see "64 Bit Installs") |
no sample available | no sample available | C:\Program Files\ | As for per-machine |
ProgramFilesFolder | C:\Program Files\ | As for per-machine | C:\Program Files (x86)\ | As for per-machine |
ProgramMenuFolder | C:\Documents and Settings\All Users\Start Menu\Programs\ | C:\Documents and Settings\Dennis\Start Menu\Programs\ | C:\ProgramData\Microsoft\Windows\Start Menu\Programs\ | C:\Users\Dennis\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\ |
RecentFolder | As for per-user | C:\Documents and Settings\Dennis\Recent\ | As for per-user | C:\Users\Dennis\AppData\Roaming\Microsoft\Windows\Recent\ |
SendToFolder | As for per-user | C:\Documents and Settings\Dennis\SendTo\ | As for per-user | C:\Users\Dennis\AppData\Roaming\Microsoft\Windows\SendTo\ |
StartMenuFolder | C:\Documents and Settings\All Users\Start Menu\ | C:\Documents and Settings\Dennis\Start Menu\ | C:\ProgramData\Microsoft\Windows\Start Menu\ | C:\Users\Dennis\AppData\Roaming\Microsoft\Windows\Start Menu\ |
StartupFolder | C:\Documents and Settings\All Users\Start Menu\Programs\Startup\ | C:\Documents and Settings\Dennis\Start Menu\Programs\Startup\ | C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\ | C:\Users\Dennis\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ |
System16Folder | C:\WINDOWS\system\ | As for per-machine | no sample available | no sample available |
System64Folder
(see "64 Bit Installs") |
no sample available | no sample available | C:\Windows\system32\ | As for per-machine |
SystemFolder | C:\WINDOWS\system32\ | As for per-machine | C:\Windows\SysWOW64\ | As for per-machine |
TempFolder | As for per-user | C:\DOCUME~1\Dennis\LOCALS~1\Temp\ | As for per-user | C:\Users\Dennis\AppData\Local\Temp\ |
TemplateFolder | C:\Documents and Settings\All Users\Templates\ | C:\Documents and Settings\Dennis\Templates\ | C:\ProgramData\Microsoft\Windows\Templates\ | C:\Users\Dennis\AppData\Roaming\Microsoft\Windows\Templates\ |
WindowsFolder | C:\WINDOWS\ | As for per-machine | C:\Windows\ | As for per-machine |
WindowsVolume | C:\ | As for per-machine | C:\ | As for per-machine |
How to use WindowsFolder |
The "WindowsFolder" name (and possibly others) are not allowed as a directory parent, this code shows a workaround:
<$Directory Key="WINDOWS_VOLUME" Parent="<$AnyDir>" DIR="AnyThing"> <$PropertyCa "WINDOWS_VOLUME" Value="[WindowsVolume]" SEQ="1-" Type="FirstSequence" SeqTable="InstallExecuteSequence InstallUISequence"> <$DirectoryTree Key="OffWindowsVolume" DIR="[WINDOWS_VOLUME]\oracle"> <$Files "TryMe.mm" DestDir="OffWindowsVolume">
I created the "WINDOWS_VOLUME" directory entry whose details don't matter and get overriden via the custom action to contain the value of "WindowsFolder". If you wanted to be able to override it from the command line you'd want to add a condition to the custom action.
Standard Windows Folder Environment Variables |
Windows has these standard environment variables, these should have Windows Installer equivalants (but could in some cases also be directly used):
Environment Variable | Example Value |
---|---|
ALLUSERSPROFILE | C:\ProgramData |
APPDATA | C:\Users\Dennis\AppData\Roaming |
CommonProgramFiles | C:\Program Files (x86)\Common Files |
HOMEDRIVE | C: |
HOMEPATH | \Users\Dennis |
ProgramFiles | C:\Program Files (x86) |
ProgramFiles(x86) | C:\Program Files (x86) |
SystemDrive | C: |
SystemRoot | C:\WINDOWS |
WinDir | C:\WINDOWS |