I need to get a filename of the own installation package within an InstallScript function. How can I do that?
How can I obtain filename of own MSI/EXE installer file?
81 Views Asked by ababo At
2
There are 2 best solutions below
1
On
I have found a way to get the filename:
function ShowInstallerFilename(hMSI)
NUMBER maxPath;
STRING originalDatabase;
begin
maxPath = MAX_PATH;
if(MsiGetProperty(hMSI, "OriginalDatabase", originalDatabase, maxPath) == ERROR_SUCCESS) then
SprintfBox(INFORMATION, "Deferred Execution", "Original database is %s", originalDatabase);
endif;
MessageBox("Done", INFORMATION);
end;
SETUPEXEDIR and SETUPEXENAME are MSI properties. You can obtain their values through the MsiGetProperty function. If you are not using an MSI then you can use the PACKAGE_LOCATION system variable, as in