给你个我用的例子:

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. SQL Server导入导出表及备份恢复

    1.   导出: 2.   导入

  2. 各种浏览器兼容trim()的方法

    一.利用while方法解决 function trim(str) { while (str[0] == ' ') { str = str.slice(1); } while (str[str.leng ...

  3. iostat iotop 查看硬盘的读写、 free 查看内存的命令 、netstat 命令查看网络、tcpdump 命令

    iostat 命令 查看硬盘的使用情况: iostat iostat -x iotop 命令: 若没安装先安装: yum install iotop -y free 命令,用于查看内存的使用量: fr ...

  4. JavaSE笔记

    this关键字 哪个对象调用方法,方法定义中的this即为该对象的引用! static关键字 使用static声名的成员变量为静态成员变量,在第一次使用的时候被初始化,static成员变量只有一份 使 ...

  5. 费马大定理以及求解a^2+b^2=c^2的奇偶数列法则

    <一>费马大定理:a^n+b^n=c^n 当n大于2时无正整数解. <二>求解a^2+b^=c^2可以使用a值奇偶法则:1.当a=2*n时,b=n^2-1,c=n^2+1   ...

  6. Spring Boot 揭秘

    SpringBoot基础 微服务 解决大一统的服务化架构的问题 代码冲突问题 交付复杂,影响面大 测试困难 微服务的好处 可扩展性 隔离性 灵活性,多语言多技术生态 微服务的挑战 保持微服务的互通性 ...

  7. MySQL--派生表Condition Pushdown优化

    如果派生表外部过滤条件可以下推到派生表内部,可以有效减少派生表内部扫描数据量和派生表使用内存甚至避免使用派生表. 如对于下面查询: SELECT * FROM ( SELECT cluster_id, ...

  8. Rendering on the Web

    转自: https://developers.google.com/web/updates/2019/02/rendering-on-the-web Rendering on the Web Goog ...

  9. Delphi中Json格式读写

    Json是一种轻量级传输数据格式,广泛应用互联网和各应用中.json主要採用键值对来表示数据项.多个数据项之间用逗号分隔,也能够用于数组.以下注重介绍一下在delphi中使用json,在delphi中 ...

  10. Hi3536DV100 SDK 安装以及升级使用说明

    第一章 Hi3536DV100_SDK_Vx.x.x.x版本升级操作说明 如果您是首次安装本SDK,请直接参看第2章. 第二章 首次安装SDK1.Hi3536DV100 SDK包位置 在"H ...