使用Inno Setup将自定义字符串值写入SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall [英] Write custom string value into SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall with Inno Setup

查看:48
本文介绍了使用Inno Setup将自定义字符串值写入SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在安装过程中,我想将自定义字符串值写入自动创建的注册表项 HKLM \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ MyApp.2020_is1

我试图在iss脚本的 [Registry] 部分中执行此操作,但是它似乎被忽略了.

  Root:HKLM;子项:"SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ {#MyAppName}.{#MyAppVersion} _is1";ValueData:一些标签";标志:uninsdeletekey;ValueType:字符串;ValueName:"CustomTag" 

这通常令人沮丧吗?还是我想念一些特别的东西?我在 [Setup] 部分中有 PrivilegesRequired = admin .

由于可以并行安装我的应用程序的多个内部版本,我希望使用户可以添加一个描述性标签,以便他们不仅可以通过内部版本号而且还可以通过标签来识别内部版本./p>

无论如何,我在注册表中搜索以前的版本时,我试图将自定义值添加到卸载键中,而不必引用另一个键来查找自定义标记.

解决方案

Uninstall 条目是安装的最后步骤之一.因此,在处理完 [Registry] 部分之后.检查安装顺序.创建条目时,其先前的内容将被完全删除,包括您的 some标记值.

正如@Bill_Stewart所说,正确的方法是使用 SetPreviousData / GetPreviousData

如果您真的想使用自己的自定义代码编写条目,则必须通过 AppName AppVerName UninstallDisplayName .

如果需要允许并行安装,则安装必须具有不同的 AppId –这是卸载程序密钥名称的一部分,因此不需要其他标签.

During installation, I'd like to write a custom string value into the automatically created registry key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MyApp.2020_is1

I tried to do this in the [Registry] section of my iss script but it seems to be ignored.

Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#MyAppName}.{#MyAppVersion}_is1"; ValueData: "some tag"; Flags: uninsdeletekey; ValueType: string; ValueName: "CustomTag"

Is this generally discouraged or am I missing something particular? I do have PrivilegesRequired=admin in the [Setup] section.

With the possibility to install multiple builds of my app side-by-side, I want to give the user the possibility to add a descriptive tag so that they can identify the build not only via build number but also the tag.

As I'm searching the registry for previous builds anyways, I was trying to add a custom value into the uninstall key instead of having to reference another key to find the custom tag.

解决方案

The Uninstall entry is created as one of the last steps of the installation. So also after the [Registry] section is processed. Check the Installation order. And when the entry is created, its previous contents is completely removed, including your some tag value.

As @Bill_Stewart already commented, the correct way is to use SetPreviousData/GetPreviousData.

If you really wanted to use your own custom code to write the entry, you will have to do it from Pascal Script in CurStepChanged(ssPostInstall) event (triggered after the Uninstall entry is created).


If you want to allow users to distinguish the installation, the tag must go to AppName or AppVerName or UninstallDisplayName.

If you need to allow parallel installations, the installations must have different AppId – which is a part of the uninstaller key name, so no additional tag should be needed.

这篇关于使用Inno Setup将自定义字符串值写入SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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