使用Inno Setup中的setup子文件夹中的文件覆盖安装的文件 [英] Overwrite installed files with files in setup subfolder in Inno Setup

查看:149
本文介绍了使用Inno Setup中的setup子文件夹中的文件覆盖安装的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近发现我的Windows 10 64位计算机上可以播放一些旧的PC游戏.我查看了各种在线资源以使游戏正常运行.现在,我有兴趣为使游戏正常运行所采取的所有各种步骤创建一个自定义安装程序.我通过Inno Setup成功地使C& C Generals可以与自定义安装程序一起使用.但是,经过一番研究和尝试以进行以下工作后,我缺乏专业知识:

I recently have found some old PC games to play on my Windows 10 64-bit computer. I have looked at various online sources to get the games working. Now I'm interested in creating a custom installer for all the various steps taken to get the games to work properly. I succeeded getting C&C Generals to work with a custom installer via Inno Setup. I however lack the expertise after a bit of research and trial to do the following:

  1. 我能够安装软件并使用官方补丁来更新已安装的软件.
  2. 我不确定如何在更新后添加脚本以从安装子文件夹复制修改后的文件,以覆盖主文件夹中已安装的文件.此更新不适用于修改后的文件.

示例:

  • 程序安装到 C:\ Program Files(x86)\ Programv1.exe .
  • 设置源文件包含一个子文件夹 \ modfiles .
  • 要使用 \ modfiles \ Programv2.exe
  • 覆盖补丁更新后的 Programv1.exe

这是否在 [Code] 部分下?它是否可以带有 postinstall 标志的 [Run] 部分下?像最后一步那样简单的复制和覆盖命令?

Does this go under the [Code] section? Can it go under the [Run] section with a postinstall flag? Like a simple copy and overwrite command as the last step?

谢谢!

推荐答案

有很多方法可以实现这一目标.

There many ways to achieve this.

  1. 您甚至可以在之前使用 AfterInstall 参数执行补丁.已安装.请参阅 Inno设置:安装其他安装程序并运行它,然后继续安装.然后,您可以将mod直接安装到安装文件夹(而不是子文件夹):

  1. You can execute the patch using the AfterInstall parameter, even before the "mod" is installed. See Inno Setup: Install other installer and run it before continuing my install. Then you can install the mod straight to the installation folder (not to the subfolder):

[Files]
; Install original game
Source: C:\source\TheGame\*; Dest: {app}
; Run patch
Source: C:\patch\PatchTheGame.exe; Dest: {tmp}; AfterInstall: RunPatch
; Install mod
Source: C:\mod\Program.exe; Dest: {app}

  • 在安装补丁后,使用 Run 条目复制mod:

    [Files]
    ; Install original game
    Source: C:\source\TheGame\*; Dest: {app}
    ; Extract the patch somewhere
    Source: C:\patch\PatchTheGame.exe; Dest: {tmp}
    ; Extract the mod somewhere
    Source: C:\mod\Program.exe; Dest: {tmp}
    
    [Run]
    Filename: {tmp}\PatchTheGame.exe
    Filename: {cmd}; Parameters: /C copy ""{tmp}\Program.exe"" ""{app}\Program.exe""
    

  • 您可以在Pascal脚本中对其进行编码.请参阅(Firebird)子安装程序完成后,在Inno Setup中安装配置文件的自定义版本

    这篇关于使用Inno Setup中的setup子文件夹中的文件覆盖安装的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆