给你个我用的例子:

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. Redis实战之Redis命令

    阅读目录 1. 字符串命令 2. 列表命令 3. 集合命令 4. 散列命令 5. 有序集合命令 6. 发布与订阅命令 7. 小试牛刀 Redis可以存储键与5种不同数据结构类型之间的映射,这5种数据结 ...

  2. 数据结构HUFFman求权值

    #include <bits/stdc++.h>using namespace std;priority_queue< int, vector <int>, greate ...

  3. BZOJ 2002:Bounce 弹飞绵羊(分块)

    2002: [Hnoi2010]Bounce 弹飞绵羊 Time Limit: 10 Sec  Memory Limit: 259 MB Submit: 14944  Solved: 7598 [Su ...

  4. C与C++中实现 gotoxy()函数

    #include <stdio.h> #include <windows.h> void gotoxy(int x, int y) { COORD pos = {x,y}; H ...

  5. Linux下安装搜狗拼音输入法

    1.安装 下面命令即可完成安装: sudo apt-add-repository ppa:fcitx-team/nightly sudo apt-get update sudo apt-get ins ...

  6. JS字符串和正则总结

    trim功能:去除字符串开始和结尾的空格. 中间空格不去掉~ 对输入字符串的处理,多输要先清除开头结尾空格,再处理 IE8不支持trim()方法. String总结:所有API都无法修改原字符串,都会 ...

  7. nginx实现nginx/tomcat负载均衡

    准备三台centos7虚拟机,全部安装nginx或者tomcat 虚拟机A 10.0.3.46        在index.html 中添加10.0.3.46作为标志 虚拟机B 10.0.3.66   ...

  8. S老师 背包系统 装备系统 锻造系统 学习

    Inventory using UnityEngine; using System.Collections; using System.Collections.Generic; using Syste ...

  9. Python自建collections模块

    本篇将学习python的另一个内建模块collections,更多内容请参考:Python学习指南 collections是Python内建的一个集合模块,提供了许多有用的集合类. namedtupl ...

  10. httpclient中文乱码

    https://blog.csdn.net/teamlet/article/details/8605840