Wise: How to install files into a path specified in the registry
Categories:
Wise Installer: Dynamically Installing Files to Registry-Defined Paths

Learn how to configure Wise Installation System to install files into a target directory whose path is retrieved from the Windows Registry, ensuring flexible and robust deployments.
When creating installers with Wise Installation System, you often need to place files in specific locations. While static paths are common, there are scenarios where the target directory is not fixed and must be determined dynamically at installation time. A powerful way to achieve this is by reading the installation path directly from the Windows Registry. This article will guide you through the process of configuring your Wise installer to leverage registry values for dynamic file placement, enhancing the flexibility and adaptability of your deployments.
Understanding the Challenge
The core challenge is that Wise, by default, uses predefined variables or hardcoded paths for file installation. To install files into a path specified in the registry, you need a mechanism to:
- Read the Registry: Extract the desired path string from a specific registry key and value.
- Store the Path: Assign this retrieved path to a Wise variable.
- Use the Variable: Configure the file installation component to use this variable as its destination.
flowchart TD A[Start Wise Installer] --> B{Read Registry Value} B --> C["Store Value in Wise Variable (e.g., INSTALLPATH)"] C --> D[Configure File Installation Component] D --> E["Set Destination to %INSTALLPATH%"] E --> F[Install Files] F --> G[End Wise Installer]
Flowchart of dynamic installation using a registry-defined path.
Step-by-Step Implementation in Wise
This section details the steps required within the Wise Installation System interface to achieve dynamic file installation. We'll assume you have a Wise project already set up and are looking to add this functionality.
1. Define a Custom Variable
Navigate to the 'Variables' tab in your Wise project. Create a new custom variable, for example, INSTALLPATH
. This variable will hold the registry-read path.
2. Add a 'Get Registry Key Value' Action
Go to the 'Installation Expert' -> 'Custom Actions' section. Add a new 'Get Registry Key Value' action. Configure it as follows:
- Registry Key: Specify the full path to the registry key (e.g.,
HKEY_LOCAL_MACHINE\SOFTWARE\MyCompany\MyApp
). - Value Name: Enter the name of the registry value that contains the desired path (e.g.,
InstallDir
). - Variable Name: Select the custom variable you created (e.g.,
INSTALLPATH
).
Place this action early in your installation sequence, typically before any file installation actions that depend on this path.
3. Configure File Installation
In the 'Files' tab, for the files you want to install dynamically, set their destination path. Instead of a fixed path, use your custom variable enclosed in percent signs: %INSTALLPATH%
.
For example, if you want to install MyApplication.exe
into the registry-defined path, you would set its destination to %INSTALLPATH%
.
4. Handle Default or Missing Registry Values (Optional but Recommended)
Consider what should happen if the registry key or value doesn't exist. You can add conditional logic using Wise scripting or another 'Set Variable' action to provide a default path if the 'Get Registry Key Value' action fails or returns an empty string. This ensures your installer doesn't fail if the registry entry is absent.
Example Registry Structure and Wise Configuration
Let's illustrate with a concrete example. Suppose your application's installation directory is stored in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\MyCompany\MyApplication
under the value name InstallPath
.
[HKEY_LOCAL_MACHINE\SOFTWARE\MyCompany\MyApplication]
"InstallPath"="C:\Program Files\MyCustomApp"
Example of a registry entry storing an installation path.
In your Wise project, you would configure the 'Get Registry Key Value' action as follows:

Configuring the 'Get Registry Key Value' action in Wise.
Then, for any files you wish to install into this path, you would specify %INSTALLPATH%
as their destination.
HKEY_LOCAL_MACHINE\SOFTWARE
on a 64-bit system, it might be redirected to HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node
. Ensure you target the correct registry view or use appropriate Wise actions to handle this.By following these steps, your Wise installer will dynamically determine the installation path from the registry, providing a flexible and robust deployment solution that adapts to existing system configurations or previous installations.