- Revenera Community
- :
- InstallShield
- :
- InstallShield Knowledge Base
- :
- Basic MSI Project: Launch Executable .exe File If the .exe File Is Found Using a System Search and F...
- Mark as New
- Mark as Read
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Basic MSI Project: Launch Executable .exe File If the .exe File Is Found Using a System Search and Force a Reboot
Basic MSI Project: Launch Executable .exe File If the .exe File Is Found Using a System Search and Force a Reboot
Summary:
This article discusses how to launch / run an .exe file if the .exe file is found by using a System Search and how to force a restart / reboot of the machine.
Resolution:
1. Create a Basic MSI Project.
2. Navigate to Behavior and Logic > System Search.
3. Add a File path, by searching folders System Search.
4. Click Next.
5. Enter the .exe filename and the full path, in the System Search Wizard, by finding the full path in File Explorer then specifying the same path in the wizard.
The full path to the Notepad++ installer .exe file in File Explorer (C:\Windows):
The System Search Wizard represents C:\Windows with [WindowsFolder]:
6. Specify the property to store the value of the search result in.
7. Navigate to the InstallScript View.
8. Create a Setup.rul file with the following InstallScript code:
#include "ifx.h"
export prototype Func1(HWND);
function Func1(hMSI)
STRING PropertyName;
NUMBER nResponse,nvSize;
begin
nvSize=MAX_PATH;
nResponse=MsiGetProperty (hMSI,"TEST",PropertyName,nvSize);
MessageBox("PropertyName:"+PropertyName,INFORMATION);
if (nResponse==0) then
LaunchApp(WINDIR ^ "npp.8.3.3.Installer.x64.exe", "");
MessageBox(WINDIR^ "npp.8.3.3.Installer.x64.exe",INFORMATION);
else
MessageBox ("Setup will now exit.", INFORMATION);
endif;
end;
9. Add an InstallScript custom action.
10. Schedule the InstallScript custom action in the Execute Sequence (Install Exec Sequence) after the standard CostFinalize Action.
11. In the Property Manager, set a property named: REBOOT
to a value of: Force
12. Build the project.
13. Run the installer.
The Notepad++ installer will be launched if it is found in the Windows folder.
Additional Information:
Here is a link to the official Microsoft documentation about the standard CostFinalize Action:
https://docs.microsoft.com/en-us/windows/win32/msi/costfinalize-action