给你个我用的例子:

Delphi/Pascal code

 

?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
; 脚本用 Inno Setup 脚本向导生成。
; 查阅文档获取创建 INNO SETUP 脚本文件详细资料!
 
[Setup]
AppName=Common downloader
AppVerName=Common downloader
DefaultDirName={pf}\XXX\Common downloader
DefaultGroupName=XXX\Common downloader
DisableProgramGroupPage=yes
OutputDir= .\Setup
OutputBaseFilename=Common downloader setup V1.0.0
Compression=lzma
SolidCompression=yes
VersionInfoCompany=XXX
VersionInfoVersion=1.0.0
 
[Languages]
Name: "Chinese"; MessagesFile: "compiler:Languages\Chinese.isl"
Name: "English"; MessagesFile: "compiler:Languages\English.isl"
 
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: dontinheritcheck
 
[Files]
Source: "CMDL.exe"; DestName: "Common downloader.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "DL.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "DM.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "config.ini"; DestDir: "{app}"; Flags: ignoreversion
Source: "App\*"; DestDir: "{app}\\App"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "Boot\*"; DestDir: "{app}\\Boot"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "Resource_cn\*"; DestDir: "{app}\Resource"; Languages: Chinese; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "Resource_en\*"; DestDir: "{app}\Resource"; Languages: English; Flags: ignoreversion recursesubdirs createallsubdirs
; 注意: 不要在任何共享系统文件中使用“Flags: ignoreversion”
 
[Icons]
Name: "{group}\Common downloader"; Filename: "{app}\Common downloader.exe"
Name: "{group}\{cm:UninstallProgram,Common downloader}"; Filename: "{uninstallexe}"
Name: "{userdesktop}\Common downloader"; Filename: "{app}\Common downloader.exe"; Tasks: desktopicon
 
[Run]
Filename: "{app}\Common downloader.exe"; Description: "{cm:LaunchProgram,Common downloader}"; Flags: nowait postinstall skipifsilent
 
[Registry]
Root: HKLM; Subkey: "Software\XXX"; Flags: createvalueifdoesntexist
Root: HKLM; Subkey: "Software\XXX\Common downloader"; Flags: uninsdeletekeyifempty
Root: HKLM; Subkey: "Software\XXX\Common downloader"; ValueType: string; ValueName: "Path"; ValueData: "{app}"
Root: HKLM; Subkey: "Software\XXX\Common downloader"; ValueType: string; ValueName: "Version"; ValueData: "V1.0.0"
Root: HKLM; Subkey: "Software\XXX\Common downloader"; ValueType: dword; ValueName: "VersionNum"; ValueData: "100"
Root: HKLM; Subkey: "Software\XXX\Common downloader"; ValueType: string; ValueName: "Release Date"; ValueData: "2008/09/29"
 
[Code]
function InitializeSetup(): Boolean;
var
   Version: string;
   strPath: string;
   ResultCode: Integer;
begin
   Result:= TRUE;
  //read the version
  if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\XXX\Common downloader',
     'Version', Version) then
  begin
    // Successfully read the value
    Version := Format('Exist the version %s,whether uninstall it?',[Version]);
    if MsgBox(Version,mbConfirmation,MB_YESNO) = IDYES then
    begin
     //read the path
     if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\XXX\Common downloader',
     'Path', strPath) then
        begin
         // Successfully read the value
         strPath:= strPath + '\unins000.exe';
         Exec(ExpandConstant(strPath), '''', SW_SHOW,
              ewWaitUntilTerminated, ResultCode);
        end;
    end else
    Result:= FALSE;
  end;
end;

这个例子可以在安装之前卸载以前的版本,并提示你卸载之前的版本信息。

Inno Setup 脚本的更多相关文章

  1. 以前编写的inno setup脚本,涵盖了自定义安装界面,调用dll等等应用 (转)

    以前编写的inno setup脚本,涵盖了自定义安装界面,调用dll等等应用 (转) ; Script generated by the Inno Setup 脚本向导. ; SEE THE DOCU ...

  2. Inno Setup脚本语法大全

    Inno Setup脚本语法大全 ResourceShare Bruce 11个月前 (10-28) 6136浏览 0评论   Inno Setup 是什么?Inno Setup 是一个免费的 Win ...

  3. inno setup脚本,涵盖了自定义安装界面,调用dll等等应用

    ; Script generated by the Inno Setup 脚本向导. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETU ...

  4. Inno Setup脚本

    某天夜晚一场狂风暴雨,由于办公室座位旁的窗户没关,笔记本电脑泡了一夜水,无法开机,无奈送修,里面的大量资料也不知道会不会丢失. is的脚本只有重新写了,重新研究了一下检测程序是否正在运行的判断方法,另 ...

  5. INNO SETUP脚本向导创建的基本脚本

    脚本范例分析:先来看看一段用INNO SETUP脚本向导创建的基本脚本的[Setup]段: [Setup]   AppName=Premiere 6.5 汉化补丁-----------------(程 ...

  6. 使用Inno SetUp脚本打包Winform程序

    在开发桌面程序时,往往需要用到打包工具将程序打包为exe可执行文件. 之前在项目中用了下 InstallShield Limited Edition for Visual Studio  2015,它 ...

  7. inno setup 脚本常用修改 转

    http://blog.sina.com.cn/s/blog_72c2eb350100y2sa.html 有人提及想更换安装界面的图片,其实方法很简单,只需要修改inno setup安装目录下的Wiz ...

  8. 用inno Setup做应用程序安装包的示例脚本(.iss文件)(

    用innoSetup做应用程序安装包的示例脚本(.iss文件),具体要看innoSetup附带的文档,好象是pascal语言写的脚本. 示例1(应用程序.exe,客户端安装): ;{089D6802- ...

  9. 使用inno setup打包程序完整脚本(.net框架检测,重复安装检测)

    ; 脚本由 Inno Setup 脚本向导 生成!; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档! #define MyAppName "小小鸟软件"#def ...

随机推荐

  1. PTA——输出各位数字

    PTA 7-37 输出整数各位数字 方法1: #include <stdio.h> #define N 10000 int main(){ long n, temp; ; scanf(&q ...

  2. c# 敏捷2 ForEach ToDictionary ToLookup Except比较

    using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; ...

  3. 黑马-Spring与数据库

    Spring与数据库 Spring与jdbc 引入dataSource 在客户端 模板编程 类的结构图, 真正干活的是JdbcTemplate(底层实现,操作 excute方法) JdbcTempla ...

  4. 【添加最新版本的mysql的jdbc连接jar包】java.math.BigInteger cannot be cast to java.lang.Long异常

    [问题描述] 从我的电脑把项目拷贝到guo小中的win8电脑,but出现了那个错误,估计他的mysql是最新版本的. [如何下载连接jar包] 链接:https://pan.baidu.com/s/1 ...

  5. 深入浅出理解 COOKIE MAPPING

    转载自:http://www.myttnn.com/digital-marketing/cookie-mapping-introduction/ 在RTB(实时竞价广告,Real-Time-Biddi ...

  6. xencenter如何安装系统

    首先点击增加服务器 输入xenserver的ip和用户名以及密码 添加资源池,注意下面那个add new server也要指定一个server,例如刚刚创建的那个 还要搞一个存储的,注意iso要选择s ...

  7. IP、端口号、MAC

    1.端口 端口是TCP/IP协议簇中,应用层进程与传输层协议实体间的通信接口.端口是操作系统可分配的一种资源:应用程序通过系统调用与某端口绑定后,传输层传给改端口的数据都被相应进程接收,相应进程发给传 ...

  8. MySQL Replication--跳过复制错误

    在MySQL中,有两种跳过复制错误的方法:1.对于未使用GTID的复制,可以使用sql_slave_skip_counter来跳过错误2.对于使用GTID的复制,可以使用GTID_NEXT模拟空事务来 ...

  9. 什么是 PWA?

    出处:https://segmentfault.com/a/1190000012353473

  10. mobx 知识点

    antd+mobx 项目例子:https://github.com/cag2050/antd_mobx_demo 在 create-react-app 创建的项目中,使用 mobx:https://s ...