- Revenera Community
- :
- InstallShield
- :
- InstallShield Knowledge Base
- :
- Using SETUPEXEDIR in InstallScript
- Mark as New
- Mark as Read
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Using SETUPEXEDIR in InstallScript
Using SETUPEXEDIR in InstallScript
Summary
How to use SETUPEXEDIR in InstallScriptSynopsis
InstallShield can access a MSI property called SETUPEXEDIR, which stores the location of the Setup.exe used to run the installation. SETUPEXEDIR does not necessarily refer to the same directory as the predefined property SourceDir, which stores the location of the MSI database used to run the installation; the directories will be different if you built a package that compresses the MSI database into Setup.exe, in which case SourceDir refers to the temporary directory into which the MSI database is decompressed.Discussion
While you can use many MSI directory properties (ProgramFilesFolder, TempFolder, SourceDir, and many others) directly in InstallScript, SETUPEXEDIR is not one of them. To read the value of any property (including SETUPEXEDIR) into an InstallScript variable, you can use the MSI API function MsiGetProperty. To create and populate a global string variable called SETUPEXEDIR into your script, you can use code similar to the following:
// global variable to store SETUPEXEDIR property value STRING SETUPEXEDIR[MAX_PATH + 1];
function OnBegin( )
NUMBER nBuffer; // local buffer-size variable
begin
if (!MAINTENANCE) then // available only during a first-time installation
nBuffer = MAX_PATH + 1; // initialize size buffer before calling MsiGetProperty
MsiGetProperty(ISMSI_HANDLE, "SETUPEXEDIR", SETUPEXEDIR, nBuffer);
// for testing: display the variable's value
MessageBox("SETUPEXEDIR = " + SETUPEXEDIR, INFORMATION);
endif;
end;