Inno Setup:如何自动卸载以前安装的版本? [英] Inno Setup: How to automatically uninstall previous installed version?

查看:270
本文介绍了Inno Setup:如何自动卸载以前安装的版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Inno Setup创建安装程序.

I'm using Inno Setup to create an installer.

我希望安装程序自动卸载以前安装的版本,而不是覆盖它.我该怎么办?

I want the installer to automatically uninstall the previous installed version, instead of overwriting it. How can I do that?

推荐答案

给定AppId(即您在[Setup]部分中用于AppID的值),您应该能够从注册表中读取卸载字符串. ).可以在Software\Microsoft\Windows\CurrentVersion\Uninstall\{AppId}\下找到(可以是HKLMHKCU,因此最好同时检查两者),其中{AppId}应该替换为您使用的实际值.查找UninstallStringQuietUninstallString值,然后使用Exec函数从InitializeSetup()事件函数运行它.

You should be able to read the uninstall string from the registry, given the AppId (i.e. the value you used for AppID in the [Setup]-section). It could be found under Software\Microsoft\Windows\CurrentVersion\Uninstall\{AppId}\ (could be either HKLM or HKCU, so best check both) where {AppId} should be substituted with the actual value you used. Look for the UninstallString or QuietUninstallString values and use the Exec function to run it from your InitializeSetup() event function.

更新:使用带有{uninstallexe}[Run]部分条目删除了无效的替代解决方案-感谢所有评论者指出了这一点!

Update: removed non-working alternative solution using a [Run]-section entry with {uninstallexe} - thanks to all commenters who pointed this out!

这篇关于Inno Setup:如何自动卸载以前安装的版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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