当 AppId 包含大括号时,检查安装是不是全新或升级不起作用

Posted

技术标签:

【中文标题】当 AppId 包含大括号时,检查安装是不是全新或升级不起作用【英文标题】:Checking if installation is fresh or upgrade does not work when AppId contains a curly bracket当 AppId 包含大括号时,检查安装是否全新或升级不起作用 【发布时间】:2019-07-20 02:01:58 【问题描述】:

我尝试运行相同的安装程序进行全新安装和升级。

如果是升级:某些文件和文件夹不应被复制,server.bat 不应运行。 我使用该功能,因为它已在问题 (Can Inno Setup respond differently to a new install and an update?) 上得到回答,我使用相同的AppId 并定义了#SetupReg,如图所示,并首次安装该应用程序,一切都很好,但是当我搜索设置日志我发现:

Line 122: 2019-02-27 15:46:13.797   Creating new uninstall key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\FDDFBC15-7B5C-4580-AD69-F54B8087A52E_is1

然后我搜索了注册表,上面的路径不存在,但我在

中找到了实际的SetupReg路径

HKLM\Softwares\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\ FDDFBC15-7B5C-4580-AD69-F54B8087A52E_is1

我已经将它定义为脚本打击,脚本中的路径是:

HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\" + AppId + "_is1

我编辑MyApp.iss 并将MyAppVersion 的值更改为"1.1.0"VersionInfoVersion1.1.0,然后再次运行安装程序,我预计它将运行升级(具有check: not IsUpgrade 的文件和文件夹应该'不复制或运行),它将禁用安装目录页面。但没有任何预期会发生。 IsUpgrade功能没有成功,check: not IsUpgrade的文件和文件夹已经正常复制并覆盖了旧的,即使server.bat覆盖了旧的也安装完成后运行。 出了什么问题?是因为#SetupReg还是function IsUpgrade还是ISS脚本?

#define MyAppName "Medfor"
#define MyAppVersion "1.0.0"
#define MyAppExeName "Medfor.exe"
#define AppId "FDDFBC15-7B5C-4580-AD69-F54B8087A52E"
#define SetupReg "Software\Microsoft\Windows\CurrentVersion\Uninstall\" + AppId + "_is1"
#define SetupAppPathReg "Inno Setup: App Path"

[Setup]
AppId=#AppId
AppName=#MyAppName
AppVersion=#MyAppVersion

[Files]
Source: "build\server.bat"; DestDir: "app"; Flags: ignoreversion; Check: not IsUpgrade

[Run]
Filename: "app\server.bat"; \
    Flags: postinstall skipifsilent runascurrentuser waituntilterminated; \
    Description: "cm:LaunchProgram,#StringChange(MyAppName, '&', '&&')"; \
    Check: not IsUpgrade
[Code]
function IsUpgrade: Boolean;
var
  S: string;
begin
  Result :=
    RegQueryStringValue(HKLM, '#SetupReg', '#SetupAppPathReg', S) or
    RegQueryStringValue(HKCU, '#SetupReg', '#SetupAppPathReg', S);
end;

第一次安装日志:

2019-02-27 15:45:48.996   Log opened. (Time zone: UTC+03:00)
2019-02-27 15:45:48.996   Setup version: Inno Setup version 5.6.1 (a)
2019-02-27 15:45:48.996   Original Setup EXE: C:\Users\user\Documents\Output\Medfor-setup.exe
2019-02-27 15:45:48.996   Setup command line: /SL5="$2307BA,9890028,58368,C:\Users\user\Documents\Output\Medfor-setup.exe" /SPAWNWND=$2B04B6 /NOTIFYWND=$390B4C 
2019-02-27 15:45:48.997   Windows version: 6.3.9600  (NT platform: Yes)
2019-02-27 15:45:48.997   64-bit Windows: Yes
2019-02-27 15:45:48.997   Processor architecture: x64
2019-02-27 15:45:48.997   User privileges: Administrative
2019-02-27 15:45:48.999   64-bit install mode: No
2019-02-27 15:45:49.004   Created temporary directory: C:\Users\user\AppData\Local\Temp\is-IH9A3.tmp
2019-02-27 15:46:11.561   Starting the installation process.
2019-02-27 15:46:11.690   Creating directory: C:\Program Files (x86)\Medfor
2019-02-27 15:46:11.690   Creating directory: C:\Program Files (x86)\Medfor\App
2019-02-27 15:46:11.691   Creating directory: C:\Program Files (x86)\Medfor\App\sections
2019-02-27 15:46:11.691   Creating directory: C:\Program Files (x86)\Medfor\App\sections\templates_sections
2019-02-27 15:46:11.691   Creating directory: C:\Program Files (x86)\Medfor\App\sections\templates_sections\headers
2019-02-27 15:46:11.692   Creating directory: C:\Program Files (x86)\Medfor\App\sections\templates_sections\modals
2019-02-27 15:46:11.693   Creating directory: C:\Program Files (x86)\Medfor\App\templates
2019-02-27 15:46:11.693   Creating directory: C:\Program Files (x86)\Medfor\App\templates\errors
2019-02-27 15:46:11.694   Creating directory: C:\Program Files (x86)\Medfor\App\templates\menus
2019-02-27 15:46:11.694   Creating directory: C:\Program Files (x86)\Medfor\App\templates\modals
2019-02-27 15:46:11.695   Creating directory: C:\Program Files (x86)\Medfor\Uploads
2019-02-27 15:46:11.696   Directory for uninstall files: C:\Program Files (x86)\Medfor
2019-02-27 15:46:11.696   Creating new uninstall log: C:\Program Files (x86)\Medfor\unins000.dat
2019-02-27 15:46:11.701   -- File entry --
2019-02-27 15:46:11.702   Dest filename: C:\Program Files (x86)\Medfor\unins000.exe
2019-02-27 15:46:11.705   Time stamp of our file: 2019-02-27 15:45:48.834
2019-02-27 15:46:11.705   Installing the file.
2019-02-27 15:46:11.719   Uninstaller requires administrator: Yes
2019-02-27 15:46:11.720   Successfully installed the file.
2019-02-27 15:46:11.721   -- File entry --
2019-02-27 15:46:11.722   Dest filename: C:\Program Files (x86)\Medfor\mfcm90u.dll
2019-02-27 15:46:11.722   Time stamp of our file: 2018-11-25 14:38:14.000
2019-02-27 15:46:11.723   Installing the file.
2019-02-27 15:46:11.731   Successfully installed the file.
2019-02-27 15:46:11.731   -- File entry --
2019-02-27 15:46:11.732   Dest filename: C:\Program Files (x86)\Medfor\Microsoft.VC90.CRT.manifest
2019-02-27 15:46:11.733   Time stamp of our file: 2018-11-25 14:38:08.000
2019-02-27 15:46:11.733   Installing the file.
2019-02-27 15:46:11.735   Successfully installed the file.
2019-02-27 15:46:11.736   -- File entry --
2019-02-27 15:46:11.737   Dest filename: C:\Program Files (x86)\Medfor\Microsoft.VC90.MFC.manifest
2019-02-27 15:46:11.738   Time stamp of our file: 2018-11-25 14:38:14.000
2019-02-27 15:46:11.738   Installing the file.
2019-02-27 15:46:11.741   Successfully installed the file.
2019-02-27 15:46:11.741   -- File entry --
2019-02-27 15:46:11.743   Dest filename: C:\Program Files (x86)\Medfor\msvcm90.dll
2019-02-27 15:46:11.743   Time stamp of our file: 2018-11-25 14:38:08.000
2019-02-27 15:46:11.743   Installing the file.
2019-02-27 15:46:11.766   Successfully installed the file.
2019-02-27 15:46:11.766   -- File entry --
2019-02-27 15:46:11.767   Dest filename: C:\Program Files (x86)\Medfor\msvcp90.dll
2019-02-27 15:46:11.768   Time stamp of our file: 2018-11-25 14:38:08.000
2019-02-27 15:46:11.768   Installing the file.
2019-02-27 15:46:11.837   Successfully installed the file.
2019-02-27 15:46:11.837   -- File entry --
2019-02-27 15:46:11.839   Dest filename: C:\Program Files (x86)\Medfor\msvcr90.dll
2019-02-27 15:46:11.839   Time stamp of our file: 2018-11-25 14:38:08.000
2019-02-27 15:46:11.839   Installing the file.
2019-02-27 15:46:11.913   Successfully installed the file.
2019-02-27 15:46:11.914   -- File entry --
2019-02-27 15:46:11.914   Dest filename: C:\Program Files (x86)\Medfor\service.bat
2019-02-27 15:46:11.915   Time stamp of our file: 2018-12-16 16:53:52.000
2019-02-27 15:46:11.915   Installing the file.
2019-02-27 15:46:11.917   Successfully installed the file.
2019-02-27 15:46:11.917   -- File entry --
2019-02-27 15:46:11.918   Dest filename: C:\Program Files (x86)\Medfor\sqlite3.dll
2019-02-27 15:46:11.918   Time stamp of our file: 2018-11-25 14:38:26.000
2019-02-27 15:46:11.918   Installing the file.
2019-02-27 15:46:12.012   Successfully installed the file.
2019-02-27 15:46:12.012   -- File entry --
2019-02-27 15:46:12.013   Dest filename: C:\Program Files (x86)\Medfor\tcl85.dll
2019-02-27 15:46:12.013   Time stamp of our file: 2018-11-25 14:38:26.000
2019-02-27 15:46:12.013   Installing the file.
2019-02-27 15:46:12.143   Successfully installed the file.
2019-02-27 15:46:12.143   -- File entry --
2019-02-27 15:46:12.145   Dest filename: C:\Program Files (x86)\Medfor\medfor.dll
2019-02-27 15:46:12.145   Time stamp of our file: 2019-02-27 13:15:42.000
2019-02-27 15:46:12.145   Installing the file.
2019-02-27 15:46:12.148   Successfully installed the file.
2019-02-27 15:46:12.149   -- File entry --
2019-02-27 15:46:12.149   Dest filename: C:\Program Files (x86)\Medfor\Medfor.exe
2019-02-27 15:46:12.150   Time stamp of our file: 2018-10-29 02:05:20.000
2019-02-27 15:46:12.150   Installing the file.
2019-02-27 15:46:12.790   Successfully installed the file.
2019-02-27 15:46:12.791   -- File entry --
2019-02-27 15:46:12.791   Dest filename: C:\Program Files (x86)\Medfor\mfc90.dll
2019-02-27 15:46:12.792   Time stamp of our file: 2018-11-25 14:38:14.000
2019-02-27 15:46:12.792   Installing the file.
2019-02-27 15:46:13.287   Successfully installed the file.
2019-02-27 15:46:13.287   -- File entry --
2019-02-27 15:46:13.288   Dest filename: C:\Program Files (x86)\Medfor\mfc90u.dll
2019-02-27 15:46:13.288   Time stamp of our file: 2018-11-25 14:38:14.000
2019-02-27 15:46:13.288   Installing the file.
2019-02-27 15:46:13.541   Successfully installed the file.
2019-02-27 15:46:13.541   -- File entry --
2019-02-27 15:46:13.542   Dest filename: C:\Program Files (x86)\Medfor\mfcm90.dll
2019-02-27 15:46:13.542   Time stamp of our file: 2018-11-25 14:38:14.000
2019-02-27 15:46:13.542   Installing the file.
2019-02-27 15:46:13.549   Successfully installed the file.
2019-02-27 15:46:13.549   -- File entry --
2019-02-27 15:46:13.550   Dest filename: C:\Program Files (x86)\Medfor\App\templates\errors\403.html
2019-02-27 15:46:13.550   Time stamp of our file: 2018-11-21 16:21:04.000
2019-02-27 15:46:13.550   Installing the file.
2019-02-27 15:46:13.552   Successfully installed the file.
2019-02-27 15:46:13.552   -- File entry --
2019-02-27 15:46:13.553   Dest filename: C:\Program Files (x86)\Medfor\App\templates\errors\404.html
2019-02-27 15:46:13.553   Time stamp of our file: 2018-11-21 16:21:04.000
2019-02-27 15:46:13.553   Installing the file.
2019-02-27 15:46:13.555   Successfully installed the file.
2019-02-27 15:46:13.555   -- File entry --
2019-02-27 15:46:13.556   Dest filename: C:\Program Files (x86)\Medfor\Uploads\Capture.gif
2019-02-27 15:46:13.557   Time stamp of our file: 2018-07-31 21:51:14.000
2019-02-27 15:46:13.557   Installing the file.
2019-02-27 15:46:13.565   Successfully installed the file.
2019-02-27 15:46:13.566   -- Icon entry --
2019-02-27 15:46:13.566   Dest filename: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Medfor.lnk
2019-02-27 15:46:13.568   Creating the icon.
2019-02-27 15:46:13.794   Successfully created the icon.
2019-02-27 15:46:13.797   Saving uninstall information.
2019-02-27 15:46:13.797   Deleting any uninstall keys left over from previous installs
2019-02-27 15:46:13.797   Creating new uninstall key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\FDDFBC15-7B5C-4580-AD69-F54B8087A52E_is1
2019-02-27 15:46:13.797   Writing uninstall key values.
2019-02-27 15:46:13.961   Installation process succeeded.
2019-02-27 15:46:13.963   Need to restart Windows? No
2019-02-27 15:46:21.260   -- Run entry --
2019-02-27 15:46:21.260   Run as: Current user
2019-02-27 15:46:21.260   Type: Exec
2019-02-27 15:46:21.260   Filename: C:\Program Files (x86)\Medfor\service.bat
2019-02-27 15:46:27.225   Process exit code: 1
2019-02-27 15:46:27.225   -- Run entry --
2019-02-27 15:46:27.225   Run as: Original user
2019-02-27 15:46:27.225   Type: Exec
2019-02-27 15:46:27.225   Filename: C:\Program Files (x86)\Medfor\Medfor.exe

第二次安装日志(预计升级)

2019-02-27 16:42:48.069   Log opened. (Time zone: UTC+03:00)
2019-02-27 16:42:48.070   Setup version: Inno Setup version 5.6.1 (a)
2019-02-27 16:42:48.070   Original Setup EXE: C:\Users\user\Documents\Output\Medfor-1.1.0-setup.exe
2019-02-27 16:42:48.070   Setup command line: /SL5="$4A052C,9889159,58368,C:\Users\user\Documents\Output\Medfor-1.1.0-setup.exe" /SPAWNWND=$9C0140 /NOTIFYWND=$5F02BC 
2019-02-27 16:42:48.070   Windows version: 6.3.9600  (NT platform: Yes)
2019-02-27 16:42:48.070   64-bit Windows: Yes
2019-02-27 16:42:48.071   Processor architecture: x64
2019-02-27 16:42:48.071   User privileges: Administrative
2019-02-27 16:42:48.074   64-bit install mode: No
2019-02-27 16:42:48.082   Created temporary directory: C:\Users\user\AppData\Local\Temp\is-Q7EVG.tmp
2019-02-27 16:43:13.652   Starting the installation process.
2019-02-27 16:43:13.662   Directory for uninstall files: C:\Program Files (x86)\Medfor
2019-02-27 16:43:13.662   Will append to existing uninstall log: C:\Program Files (x86)\Medfor\unins000.dat
2019-02-27 16:43:13.668   -- File entry --
2019-02-27 16:43:13.669   Dest filename: C:\Program Files (x86)\Medfor\unins000.exe
2019-02-27 16:43:13.673   Time stamp of our file: 2019-02-27 16:42:47.947
2019-02-27 16:43:13.673   Dest file exists.
2019-02-27 16:43:13.673   Time stamp of existing file: 2019-02-27 15:45:48.834
2019-02-27 16:43:13.673   Version of our file: 51.52.0.0
2019-02-27 16:43:13.674   Version of existing file: 51.52.0.0
2019-02-27 16:43:13.674   Installing the file.
2019-02-27 16:43:13.700   Uninstaller requires administrator: Yes
2019-02-27 16:43:13.700   Leaving temporary file in place for now.
2019-02-27 16:43:13.701   -- File entry --
2019-02-27 16:43:13.703   Dest filename: C:\Program Files (x86)\Medfor\mfcm90u.dll
2019-02-27 16:43:13.703   Time stamp of our file: 2018-11-25 14:38:14.000
2019-02-27 16:43:13.703   Dest file exists.
2019-02-27 16:43:13.703   Time stamp of existing file: 2018-11-25 14:38:14.000
2019-02-27 16:43:13.704   Installing the file.
2019-02-27 16:43:13.716   Successfully installed the file.
2019-02-27 16:43:13.716   -- File entry --
2019-02-27 16:43:13.718   Dest filename: C:\Program Files (x86)\Medfor\Microsoft.VC90.CRT.manifest
2019-02-27 16:43:13.719   Time stamp of our file: 2018-11-25 14:38:08.000
2019-02-27 16:43:13.719   Dest file exists.
2019-02-27 16:43:13.719   Time stamp of existing file: 2018-11-25 14:38:08.000
2019-02-27 16:43:13.719   Installing the file.
2019-02-27 16:43:13.724   Successfully installed the file.
2019-02-27 16:43:13.725   -- File entry --
2019-02-27 16:43:13.727   Dest filename: C:\Program Files (x86)\Medfor\Microsoft.VC90.MFC.manifest
2019-02-27 16:43:13.728   Time stamp of our file: 2018-11-25 14:38:14.000
2019-02-27 16:43:13.728   Dest file exists.
2019-02-27 16:43:13.728   Time stamp of existing file: 2018-11-25 14:38:14.000
2019-02-27 16:43:13.728   Installing the file.
2019-02-27 16:43:13.733   Successfully installed the file.
2019-02-27 16:43:13.734   -- File entry --
2019-02-27 16:43:13.735   Dest filename: C:\Program Files (x86)\Medfor\msvcm90.dll
2019-02-27 16:43:13.736   Time stamp of our file: 2018-11-25 14:38:08.000
2019-02-27 16:43:13.736   Dest file exists.
2019-02-27 16:43:13.736   Time stamp of existing file: 2018-11-25 14:38:08.000
2019-02-27 16:43:13.736   Installing the file.
2019-02-27 16:43:13.770   Successfully installed the file.
2019-02-27 16:43:13.771   -- File entry --
2019-02-27 16:43:13.773   Dest filename: C:\Program Files (x86)\Medfor\msvcp90.dll
2019-02-27 16:43:13.773   Time stamp of our file: 2018-11-25 14:38:08.000
2019-02-27 16:43:13.774   Dest file exists.
2019-02-27 16:43:13.774   Time stamp of existing file: 2018-11-25 14:38:08.000
2019-02-27 16:43:13.774   Installing the file.
2019-02-27 16:43:13.870   Successfully installed the file.
2019-02-27 16:43:13.871   -- File entry --
2019-02-27 16:43:13.872   Dest filename: C:\Program Files (x86)\Medfor\msvcr90.dll
2019-02-27 16:43:13.873   Time stamp of our file: 2018-11-25 14:38:08.000
2019-02-27 16:43:13.873   Dest file exists.
2019-02-27 16:43:13.873   Time stamp of existing file: 2018-11-25 14:38:08.000
2019-02-27 16:43:13.873   Installing the file.
2019-02-27 16:43:13.977   Successfully installed the file.
2019-02-27 16:43:13.978   -- File entry --
2019-02-27 16:43:13.980   Dest filename: C:\Program Files (x86)\Medfor\server.bat
2019-02-27 16:43:13.981   Time stamp of our file: 2019-02-27 16:37:22.000
2019-02-27 16:43:13.981   Dest file exists.
2019-02-27 16:43:13.981   Time stamp of existing file: 2019-02-27 16:40:59.984
2019-02-27 16:43:13.981   Installing the file.
2019-02-27 16:43:13.985   Successfully installed the file.
2019-02-27 16:43:13.986   -- File entry --
2019-02-27 16:43:13.987   Dest filename: C:\Program Files (x86)\Medfor\sqlite3.dll
2019-02-27 16:43:13.988   Time stamp of our file: 2018-11-25 14:38:26.000
2019-02-27 16:43:13.988   Dest file exists.
2019-02-27 16:43:13.988   Time stamp of existing file: 2018-11-25 14:38:26.000
2019-02-27 16:43:13.988   Installing the file.
2019-02-27 16:43:14.159   Successfully installed the file.
2019-02-27 16:43:14.193   -- File entry --
2019-02-27 16:43:14.194   Dest filename: C:\Program Files (x86)\Medfor\tcl85.dll
2019-02-27 16:43:14.195   Time stamp of our file: 2018-11-25 14:38:26.000
2019-02-27 16:43:14.195   Dest file exists.
2019-02-27 16:43:14.195   Time stamp of existing file: 2018-11-25 14:38:26.000
2019-02-27 16:43:14.195   Installing the file.
2019-02-27 16:43:14.421   Successfully installed the file.
2019-02-27 16:43:14.422   -- File entry --
2019-02-27 16:43:14.424   Dest filename: C:\Program Files (x86)\Medfor\medfor.dll
2019-02-27 16:43:14.424   Time stamp of our file: 2019-02-27 13:15:42.000
2019-02-27 16:43:14.425   Dest file exists.
2019-02-27 16:43:14.425   Time stamp of existing file: 2019-02-27 13:15:42.000
2019-02-27 16:43:14.425   Installing the file.
2019-02-27 16:43:14.431   Successfully installed the file.
2019-02-27 16:43:14.431   -- File entry --
2019-02-27 16:43:14.433   Dest filename: C:\Program Files (x86)\Medfor\Medfor.exe
2019-02-27 16:43:14.434   Time stamp of our file: 2018-10-29 02:05:20.000
2019-02-27 16:43:14.434   Dest file exists.
2019-02-27 16:43:14.434   Time stamp of existing file: 2018-10-29 02:05:20.000
2019-02-27 16:43:14.434   Installing the file.
2019-02-27 16:43:15.386   Successfully installed the file.
2019-02-27 16:43:15.387   -- File entry --
2019-02-27 16:43:15.388   Dest filename: C:\Program Files (x86)\Medfor\mfc90.dll
2019-02-27 16:43:15.389   Time stamp of our file: 2018-11-25 14:38:14.000
2019-02-27 16:43:15.389   Dest file exists.
2019-02-27 16:43:15.389   Time stamp of existing file: 2018-11-25 14:38:14.000
2019-02-27 16:43:15.389   Installing the file.
2019-02-27 16:43:16.087   Successfully installed the file.
2019-02-27 16:43:16.088   -- File entry --
2019-02-27 16:43:16.089   Dest filename: C:\Program Files (x86)\Medfor\mfc90u.dll
2019-02-27 16:43:16.089   Time stamp of our file: 2018-11-25 14:38:14.000
2019-02-27 16:43:16.089   Dest file exists.
2019-02-27 16:43:16.089   Time stamp of existing file: 2018-11-25 14:38:14.000
2019-02-27 16:43:16.090   Installing the file.
2019-02-27 16:43:16.432   Successfully installed the file.
2019-02-27 16:43:16.432   -- File entry --
2019-02-27 16:43:16.434   Dest filename: C:\Program Files (x86)\Medfor\mfcm90.dll
2019-02-27 16:43:16.435   Time stamp of our file: 2018-11-25 14:38:14.000
2019-02-27 16:43:16.435   Dest file exists.
2019-02-27 16:43:16.435   Time stamp of existing file: 2018-11-25 14:38:14.000
2019-02-27 16:43:16.435   Installing the file.
2019-02-27 16:43:16.450   Successfully installed the file.
2019-02-27 16:43:16.450   -- File entry --
2019-02-27 16:43:16.451   Dest filename: C:\Program Files (x86)\Medfor\App\templates\errors\403.html
2019-02-27 16:43:16.452   Time stamp of our file: 2018-11-21 16:21:04.000
2019-02-27 16:43:16.452   Dest file exists.
2019-02-27 16:43:16.452   Time stamp of existing file: 2018-11-21 16:21:04.000
2019-02-27 16:43:16.452   Installing the file.
2019-02-27 16:43:16.455   Successfully installed the file.
2019-02-27 16:43:16.456   -- File entry --
2019-02-27 16:43:16.457   Dest filename: C:\Program Files (x86)\Medfor\App\templates\errors\404.html
2019-02-27 16:43:16.457   Time stamp of our file: 2018-11-21 16:21:04.000
2019-02-27 16:43:16.457   Dest file exists.
2019-02-27 16:43:16.457   Time stamp of existing file: 2018-11-21 16:21:04.000
2019-02-27 16:43:16.457   Installing the file.
2019-02-27 16:43:16.460   Successfully installed the file.
2019-02-27 16:43:16.460   -- File entry --
2019-02-27 16:43:16.461   Dest filename: C:\Program Files (x86)\Medfor\Uploads\Capture.gif
2019-02-27 16:43:16.462   Time stamp of our file: 2018-07-31 21:51:14.000
2019-02-27 16:43:16.462   Dest file exists.
2019-02-27 16:43:16.462   Time stamp of existing file: 2018-07-31 21:51:14.000
2019-02-27 16:43:16.462   Installing the file.
2019-02-27 16:43:16.478   Successfully installed the file.
2019-02-27 16:43:16.480   -- Icon entry --
2019-02-27 16:43:16.480   Dest filename: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Medfor.lnk
2019-02-27 16:43:16.483   Creating the icon.
2019-02-27 16:43:16.630   Successfully created the icon.
2019-02-27 16:43:16.634   Saving uninstall information.
2019-02-27 16:43:16.634   Renaming uninstaller.
2019-02-27 16:43:16.635   Deleting any uninstall keys left over from previous installs
2019-02-27 16:43:16.636   Creating new uninstall key: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\FDDFBC15-7B5C-4580-AD69-F54B8087A52E_is1
2019-02-27 16:43:16.637   Writing uninstall key values.
2019-02-27 16:43:16.828   Installation process succeeded.
2019-02-27 16:43:16.830   Need to restart Windows? No
2019-02-27 16:43:21.677   -- Run entry --
2019-02-27 16:43:21.677   Run as: Current user
2019-02-27 16:43:21.677   Type: Exec
2019-02-27 16:43:21.677   Filename: C:\Program Files (x86)\Medfor\server.bat
2019-02-27 16:43:22.055   Process exit code: 0
2019-02-27 16:43:22.055   -- Run entry --
2019-02-27 16:43:22.055   Run as: Original user
2019-02-27 16:43:22.055   Type: Exec
2019-02-27 16:43:22.055   Filename: C:\Program Files (x86)\Medfor\Medfor.exe

【问题讨论】:

你为什么要这样做? -- 我在这里闻到了XY problem。 正如您在之前的回答中提到的我的更新问题。代码包含该值:“HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\“AppId”。但我上面的应用程序没有创建那个,甚至没有定义 SetupAppPathReg @MartinPrikryl 您的 cmets 证实了我的假设,即这确实是 XY 问题。您要实现什么功能 你还会删除另一个问题中的 cmets 吗? - 现在您已经提出了一个单独的问题,因此不需要它们。 好的,我将删除另一个问题中的 cmets。注意:我问了另一个问题来详细解释它,因为你总是喜欢从另一个人那里问一个不在 cmets @MartinPrikryl 中的单独的新问题 【参考方案1】:

那是因为您的“AddId”是xxx,而不是xxx(检查您问题中的注册表项路径)。 AppId directive 中需要双大括号,因为在 Inno Setup 指令中大括号具有特殊含义(对于 constants)。如果要按字面意思使用大括号,则必须将其加倍。

但在 Pascal Script 代码中,大括号没有特殊含义。因此,如果您使用两个,您的 Pascal 脚本代码将在注册表中显式查找 xxx。当然,它不会在那里找到它,因为那里有 xxx

解决此问题的一种方法(在指令和代码之间不重复 xxx)是仅在 AppId 指令中使用预处理器将大括号加倍:

#define AppId "FDDFBC15-7B5C-4580-AD69-F54B8087A52E"
; One curly bracket for Pascal Script code
#define SetupReg "Software\Microsoft\Windows\CurrentVersion\Uninstall\" + AppId + "_is1"

[Setup]
; Two curly brackets for directive
AppId=#StringChange(AppId, '', '')

【讨论】:

以上是关于当 AppId 包含大括号时,检查安装是不是全新或升级不起作用的主要内容,如果未能解决你的问题,请参考以下文章

试编写一个算法从检查一个Java语言中的大括号方括号小括号是不是配对,若能够全?

在c#请用Stack来检查程序的语句或公式是不是括号匹配

Laravel 5 BookStack全新安装不加载任何外部文件

Transact-SQL 语法约定

嵌套类的值初始化

使用 spark.sql parse_url() 从包含大括号或管道的 URL 中提取主机