相关疑难解决方法(0)

Inno Setup - 检查文件是否存在于目标中,否则如果不中止安装

我需要安装程序检查目标位置是否存在文件,如果不存在,则安装将中止.我的项目是一个更新补丁,所以如果应用程序的主exe不在目标中,我希望安装程序避免安装更新文件.我怎样才能做到这一点?

有人可以通过Windows注册表提供代码示例来检查文件版本吗?

[Files]
Source C:\filename.exe; DestDir {app}; Flags: ignoreversion; BeforeInstall: CheckForFile;

[code]

procedure CheckForFile(): Boolean;
begin
  if (FileExists('c:\somefile.exe')) then
  begin
    MsgBox('File exists, install continues', mbInformation, MB_OK);
    Result := True;
  end
  else
  begin
    MsgBox('File does not exist, install stops', mbCriticalError, MB_OK);
    Result := False;
  end;
end;
Run Code Online (Sandbox Code Playgroud)

windows installer inno-setup

13
推荐指数
2
解决办法
3万
查看次数

标签 统计

inno-setup ×1

installer ×1

windows ×1