使用 FileCopy 函数在 Inno Setup Pascal 代码中安装文件(不以向导形式显示安装)

Install file in Inno Setup Pascal code using FileCopy function (not to show the installation on wizard form)

如何使用FileCopy功能将文件复制到应用程序文件夹,使其名称不显示在安装页面? (FilenameLabel).

即我想使用

的第一个选项

使用FileCopy function in the CurStepChanged event function:

[Files]
Source: "MyProg.exe"; Flags: dontcopy

[Code]

procedure CurStepChanged(CurStep: TSetupStep);
begin
  { Install after installation, as then the application folder exists already }
  if CurStep = ssPostInstall then
  begin
    Log('Installing file');
    ExtractTemporaryFile('MyProg.exe');
    if FileCopy(
         ExpandConstant('{tmp}\MyProg.exe'), ExpandConstant('{app}\MyProg.exe'),
         False) then
    begin
      Log('File installed.');
    end
      else
    begin
      Log('Failed to install file.');
    end;
  end;
end;