How to launch a file after an installation
The following article uses options that are available starting with the Professional edition and project type.
For some installation packages you may want to launch a file after the install process is finished.
1. The user can decide if the file will be launched
On the exit dialog, the user will have the option through a checkbox to decide if the file should be launched or not. For this, you can follow these steps:
- Go to the File and Folders page and add the file that needs to be launched
- Go to the Dialogs page and select "ExitDialog"
- Enable the "Launch application at the end of the installation" option
- Select the file you want to launch
After following the above steps, this is how the configuration should look like:
.
In a silent or Basci UI installation, the file will no be launched since there is no dialog dispayed.
2. The user cannot decide if the file will be launched
To launch the file, you can use the predefined launch file custom action. In order to use the custom action you can follow the steps below:
- Go to the Custom Actions page
- Set the "File To Launch" field to the path of the file
- Select the When the system is being modified (deferred) option for the Execution Time
- Set the "Condition" field in the "Execution Stage Condition" section to (Not Installed)
After following the above steps, this is how the custom action should look like:
There are a few options to consider when configuring the custom action:
Since the scope is to launch the file, we can disable Wait for return code at the end of the sequence options.
Custom actions that are executable files must return a value of 0 for success. The installer interprets any other return value as failure. If you cannot change the return code of the file that we want to launch, you can disable the Fail installation if custom action returns an error option.
If the file that is being launched requires admin privileges e.g. makes changes on the machine, you need to enable the Run under the LocalSystem account with full privileges (no impersonation) option.
Using the custom action approach, the file will be launched no matter the UI level used for the installation e.g. silent installation or full UI installation and the user does not have any option to disable the file from being launched.