Windows Installer, Java Installer, Freeware Installer
Home|Contact|Site Map|TOC|Search
Download  Features   Java  Licensing  Purchase  Testimonials  Support  Forums

How do I install files in a custom folder?

Answer

The Files and Folders page offers a lot of predefined folders in which you can install files. The paths of these folders are explained in the Folder Paths article. However, when you need to install files into a custom location which is not present in the "Files and Folders" page, you need to define your custom path.

Install in the "C:\" folder

When installing an application you may need to install some files directly on the C: drive. This can be done in two ways:

1. You use the Windows Volume folder in the "Files and Folders" page. This folder is resolved at runtime to the drive which contains the Windows installation (usually it's the C: drive). If you use this folder you will make sure that your files are installed in the root of the system drive.

2. You use a property-based folder. In order to use this type of folder you can follow these steps:

  • go to the Install Parameters page
  • create a new property and name it MY_DIR (you can use any name you want as long as it contains only uppercase letters)
  • set the value of this property to C:\
  • go to the "Files and Folders" page
  • create a property-based folder by using the custom property
  • add your files in this folder

When the installation runs, the path of the property-based folder will be set to the value of the property.

Install in a custom folder

Although it is not very obvious, most of the times you need to install files into a custom folder you can use the "Files and Folders" page. This is because it contains predefined folders which cover all the important locations on the system drive.

For example, if you want to install files in the C:\MyFolder\MySubFolder directory, you can use the "Windows Volume" folder. After you create the MyFolder directory in "Windows Volume" and the MySubFolder directory in "MyFolder", you will obtain the path you need. This also applies to the other predefined folders ("Program Files", "Common Files" etc.).

However, if you cannot built the path you need by using the predefined folders, you can create a property-based folder which points to the path you want. For the above example, you would create a custom property which has the value C:\MyFolder\MySubFolder. This custom property can be used to create a property-based folder which will contain your files.

An example: installing in the user profile folder

In order to install files or create subfolders in the user profile folder (usually "Documents and Settings\<username>" on Windows 2000/XP and "Users\<username>" on Windows Vista) follow the steps below:

1. In the Install Parameters page, create a new public property (only upper-case letters in its name), for instance USER_PROFILE.

2. In the Files and Folders page create a new property based folder, specifying the property you have defined above. You can now add content to this property based folder.

3. Return to the Install Parameters page and delete the USER_PROFILE Property.

4. In the Custom Actions page, make sure that the AppSearch standard action is visible in the tree control under both InstallUISequence and InstallExecuteSequence. If it is not, use the "Show Standard Action" toolbar button or context-menu entry to make it visible.

5. Under "InstallUISequence -> AppSearch" create a new "Property Set with Formatted" Custom Action with the following settings:

Property Name : USER_PROFILE
Formatted Text: [%USERPROFILE]

At install time the value of the USER_PROFILE Property will be set to the value of the USERPROFILE environment variable, which contains the full path to the current user's profile folder.

6. Keeping the SHIFT key pressed, drap-and-drop the custom action in tree control, under "InstallExecuteSequence -> AppSearch". This will create a copy of the action in the InstallExecuteSequence.

7. Set the Scheduling Option for the custom action to "Execute only once if present in both sequence tables".

8. For both instances of the custom action set the Execution Condition to: USER_PROFILE="".

Privacy Policy | Windows Installer | Search Engine Ranking | Link Analyzer