如何更改 Inno Setup DisplayName 卸载条目

How to change Inno Setup DisplayName uninstall entry

我正在使用 Inno Setup 创建一个安装程序,它正在

下创建一个注册表项
HKLM\SOSTWARE\Microsoft\Windows\CurrentVersion\Uninstall\My_Key

我想将 DisplayName : My Program version 1.0 覆盖为 DisplayName : My Program 1.0

我在脚本中添加了以下行,但它不起作用。

[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\My_Key"; ValueType: string; ValueName: "DisplayName"; ValueData: "My Program 1.0";  Flags:createvalueifdoesntexist

即它正在创建 DisplayName : My Program version 1.0 而不是 DisplayName : My Program 1.0.

脚本中有什么我应该做的吗?

DisplayName 条目的格式由 UninstallDisplayName directive. It defaults to the value of the AppVerName directive 控制,后者又默认为 NameAndVersion "custom" 消息

NameAndVersion=%1 version %2

%1替换为AppName and %2 replaced by a value of the AppVersion的值。

所以要么:

  • UninstallDisplayName(或AppVerName)更改为您想要的显式值:

    [Setup]
    UninstallDisplayName=My Program 1.0
    
  • 或更改 NameAndVersion 消息以排除 "version" 部分:

    [Messages]
    NameAndVersion=%1 %2