我已经安装了一个java应用程序,我想在同一个位置重新安装新的更新。但我无法读取软件安装的位置。
I want if the full application is being installed in d:/program files then
the new setup should also be installed to the same location
答案 0 :(得分:3)
主要应用程序安装脚本
[Setup]
AppId=MyMainApplicationId
AppName=MyApplicationName
AppVersion=MyApplicationVersion
更新安装脚本
[Setup]
AppId=MyMainApplicationId
AppName=MyUpdateName
AppVersion=MyUpdateVersion
由于两个安装脚本具有完全相同的AppId
,因此更新将使用与主应用程序相同的目录。但是......如果安装了主应用程序,您应该实现查找。
您可以尝试将此[Code]
放入更新安装脚本:
[Code]
function InitializeSetup: Boolean;
var
sUnInstallString: String;
begin
if RegValueExists(HKEY_LOCAL_MACHINE,
'Software\Microsoft\Windows\CurrentVersion\Uninstall\MyMainApplicationId_is1',
'UninstallString') then
begin
Result := True;
end
else begin
MsgBox('Main Application was not found!', mbInformation, MB_OK);
Result := False;
Exit;
end;
end;