1
我已经安装了一个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
我已经安装了一个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
主要应用的安装脚本
[Setup]
AppId=MyMainApplicationId
AppName=MyApplicationName
AppVersion=MyApplicationVersion
更新安装脚本
[Setup]
AppId=MyMainApplicationId
AppName=MyUpdateName
AppVersion=MyUpdateVersion
由于两个installscripts有非常相同的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;
它,这是基于安装脚本Inno Setup的,就用同样的'AppId' - 默认'AppId'是一样'AppName'。如果您的更新将具有与主安装程序相同的'AppId',则它将读取应用程序位置。 – RobeN
我为此使用inno setup,我并不擅长编写脚本。 –
也可以使用相同的安装程序执行更新和原始安装 - 这通常是小型应用程序的最佳主意。你可以使用'DisableDirPage = auto'和'DisableProgramGroupPage = auto'来解决这个问题。通常情况下,您不需要做任何其他特殊的事情,但是您可能需要添加一些使用'GetVersionNumbers'来检测当前版本(如果有)并防止意外降级的代码。最后,请注意,您可以使用'WizardForm.PrevAppDir'来检测以前的安装并获取其{'app}'路径。 – Miral