Use a Set Directory action to create a directory in a path retrieved from an Environment Variable on the machine.


Article ID: 180758


Updated On:


Symantec Products




How do I create a folder directly under the user's profile folder or other locations that can be retrieved through an environment variable on the machine?

There may be occasions when files in your installation package pertain to the user currently logged onto the computer. These may be user-specific data files or text files that vary from user to user that your application updates.

Althrough the steps below are specific to using the USERPROFILE environment variable to create a directory in that path, these steps can also be used for any environement variable that is on the users machine, in the same manner.

To create a folder under the user's profile folder, complete the following steps:

  1. Open Wise for Windows Installer, Wise for Visual Studio .NET, or Windows Installer Editor in Wise Package Studio.
  2. Select Tools > Options. The Wise Options dialog appears.
  3. Click the Installation Expert tab and, if not all ready marked, mark the View directory for all features on Files page checkbox. Click OK.
  4. Select the Files page in Installation Expert.
  5. Add the files that you need installed to the user's profile into a new directory.
  6. Select View > MSI Script.
  7. Select Normal Installation from the Installation Mode drop-down list.
  8. Click the Execute Immediate tab.
  9. Click the line after CostFinalize.
  10. In the Actions list, double-click Set Directory. The Set Directory dialog appears.
  11. On the Details tab, enter the following information:

    * Custom Action Name: SetPROFILE
    * Directory: Browse for folder created in Step 5.
    * Directory Value: [%USERPROFILE]\ where should be replaced with the name of the folder you want to create.
  12. Click OK.
At runtime, the installation resolves the value of the environment variable USERPROFILE and appends the folder name to this location. The folder is then created and the files you placed into this folder at design time are installed.