问题
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:
- I am able to install the software and use the official patch to update the installed software.
 - I am unsure how to add a script to copy modified files from the install subfolder to overwrite the installed files in the main folder after the update. The update does not work on the modified files.
 
Example:
- Program installs to 
C:\Program Files (x86)\Programv1.exe. - Setup source files include a subfolder 
\modfiles. - Would like to overwrite 
Programv1.exepost patch update with\modfiles\Programv2.exe 
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?
Thanks!
回答1:
There many ways to achieve this.
You can execute the patch using the
AfterInstallparameter, 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}Use
Runentry to copy the mod after you install the patch:[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""You can code it in Pascal Script. See Install customized version of configuration file in Inno Setup after (Firebird) subinstaller finishes
来源:https://stackoverflow.com/questions/65161551/overwrite-installed-files-with-files-in-setup-subfolder-in-inno-setup