首页 > 其他分享 >Inno Setup使用总结

Inno Setup使用总结

时间:2024-02-19 15:00:32浏览次数:17  
标签:总结 Tasks Name Setup Flags Components Inno app Description

Inno Setup是一个免费的 Windows 安装程序制作软件,其使用核心在于.iss脚本文件的制作,脚本制作完成后,可进行构建-编译制作安装包。

1 宏定义#define

自定义一些全局变量,可以在下文中用到,定义安装包名称变量如下:

#define MyAppName "呼吸机服务安装包"

2 [Setup]

设置安装包名称、作者等基础信息,设置安装包名称如下:

AppName={#MyAppName}
[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
AppId={{A9861883-31C5-4324-BD9A-DC3271EEB675}
;程序名
AppName=ISsample
;版本号
AppVerName=ISsample 1.0.0.0
;发布者名
AppPublisher=Hkiss
;相关连接
AppPublisherURL=http://zwkufo.blog.163.com
AppSupportURL=http://zwkufo.blog.163.com
AppUpdatesURL=http://zwkufo.blog.163.com
;默认安装目录
DefaultDirName={pf}\ISsample
;默认开始菜单名
DefaultGroupName=ISsample
;是否打开->可选安装开始菜单项
;AllowNoIcons=yes
;安装协议
;LicenseFile=C:\Example\原始文件\agreement.txt
;安装前查看的文本文件
;InfoBeforeFile=C:\Example\原始文件\Setup_New.txt
;安装后查看文本文件
;InfoAfterFile=C:\Example\原始文件\Setup_Old.txt
;输出文件夹
OutputDir=C:\Example\InnoSetup\out
;输出文件名
OutputBaseFilename=setup
;安装图标
SetupIconFile=C:\Example\原始文件\title.ico
;安装需要输入密码
;Password=123
;Encryption=yes
;压缩相关
Compression=lzma
SolidCompression=yes
;可以让用户忽略选择语言相关
ShowLanguageDialog = yes
;备注版本信息
VersionInfoCompany=HTTP://www.Hkiss.COM
VersionInfoDescription=ISsample 汉化增强版
VersionInfoVersion=1.0.0.0
VersionInfoCopyright=Copyright (C) 2007-2008 Hkiss

3 [Languages]

设置安装语言。

[Languages]
Name: "chs"; MessagesFile: "compiler:Default.isl" ;LicenSeFile :"C:\Example\原始文件\chs\agreement.txt"
Name: "en"; MessagesFile: "compiler:Languages\English.isl";LicenSeFile :"C:\Example\原始文件\en\agreement.txt"

4 [Types]

安装类型设置。

[Types]
Name: Full ;Description:"完全安装"; Flags: iscustom
Name: Compact ;Description:"简洁安装";
Name: Custom; Description:"自定义安装";

5 [Components]

组件选择(可选择),会受到[Types]的影响

[Components]
Name: c1; Description: "自定义任务3" ; Types: Full
Name: a1; Description: "安装Components_1"; Types: Full Compact Custom ;
Name: a2; Description: "安装Components_2"; Types : Full   Compact
Name: a3; Description: "安装Components_3"; Types : Full
Name: a; Description: a 
Name: b; Description: b 

6 [Tasks]

附加任务执行(可选择)。

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "Tasks_1" ; Description:"用户自定义任务1"; Flags: unchecked
Name: "Tasks_2" ; Description:"用户自定义任务2"; Flags: unchecked
;选择了组件才会出现的定制任务
Name: "Tasks_3" ; Description:"用户自定义任务3";Components: c1 ; Flags: unchecked
;支持包含 not、and 和 or 操作
Name: p; Description: a or b; Components: a or b 
Name: q; Description: a and b; Components: a and b 
Name: r; Description: not a or b; Components: not a or b 
Name: s; Description: not (a or b); Components: not (a or b) 
Name: t; Description: a or b - old style; Components: a b

7 [Files]

文件安装。

[Files]
;多语言安装环境设置    公共参数Languages 来设置
Source: "C:\Example\原始文件\enfile.txt"; DestDir: "{app}"; Languages: en ; Flags: ignoreversion
Source: "C:\Example\原始文件\chsfile.txt"; DestDir: "{app}"; Languages: chs ; Flags: ignoreversion
;用户自定义任务 Tasks
Source: "C:\Example\原始文件\Tasks\tasks_1.txt"; DestDir: "{app}\Tasks"; Flags: ignoreversion ;Tasks : Tasks_1
Source: "C:\Example\原始文件\Tasks\tasks_2.txt"; DestDir: "{app}\Tasks"; Flags: ignoreversion ;Tasks :Tasks_2
Source: "C:\Example\原始文件\Tasks\tasks_Components.txt"; DestDir: "{app}\Tasks"; Flags: ignoreversion ;Tasks :Tasks_2
;用户定义组件安装
Source: "C:\Example\原始文件\Components\Components_1.txt"; DestDir: "{app}\Components"; Flags: ignoreversion ; Components: a1;
Source: "C:\Example\原始文件\Components\Components_2.txt"; DestDir: "{app}\Components"; Flags: ignoreversion ; Components: a2;
Source: "C:\Example\原始文件\Components\Components_3.txt"; DestDir: "{app}\Components"; Flags: ignoreversion ; Components: a3;
Source: "C:\Example\原始文件\Components\Components_4.txt"; DestDir: "{app}\Components"; Flags: ignoreversion ; Components: a1 a2 a3;
用户注册自定义Dll文件      regserver 注册 noregerror 不显示错误信息
Source: "C:\Example\原始文件\jmail.dll"; DestDir: "{app}"; Flags: ignoreversion regserver
;添加自述文件
Source: "C:\Example\原始文件\ISsample.txt"; DestDir: "{app}"; Flags: ignoreversion
;添加一个文件到缓存文件夹{Tmp} deleteafterinstall 安装后删除
Source: "C:\Example\原始文件\test.exe"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall
Source: "C:\Example\原始文件\ISsample.chm"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Example\原始文件\ISsample.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Example\原始文件\ISsample.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Example\原始文件\ISsample.ini"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Example\原始文件\ISsample.rar"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Example\原始文件\ISsample_sys.dll"; DestDir: "{win}\System32"; Flags: ignoreversion
Source: "C:\Example\原始文件\log\*"; DestDir: "{app}\log"; Flags: ignoreversion recursesubdirs createallsubdirs
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion”

8 [Icons]

开始菜单,桌面快捷方式。

[Icons]
Name: "{group}\ISsample"; Filename: "{app}\ISsample.exe"
Name: "{group}\{cm:ProgramOnTheWeb,ISsample}"; Filename: "http://zwkufo.blog.163.com"
Name: "{group}\{cm:UninstallProgram,ISsample}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\ISsample"; Filename: "{app}\ISsample.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\ISsample"; Filename: "{app}\ISsample.exe"; Tasks: quicklaunchicon
;添加一个帮助文挡
Name: {group}\ISsample 1.0.0.0 帮助文档;Filename: {app}\ISsample.chm

9 [Run]

文件安装完成后,运行程序,像bat命令和exe执行程序。

[Run]
Filename: "{app}\ISsample.exe"; Description: "{cm:LaunchProgram,ISsample}"; Flags: nowait postinstall skipifsilent
Filename: "{app}\ISsample.txt"; Description: "查看显示自述文件"; Flags: postinstall skipifsilent shellexec

10 [Messages]

更改显示在程序中显示的消息文本。

[Messages]
BeveledLabel=HKiss科技
;卸载对话框说明
ConfirmUninstall=您真的想要从电脑中卸载ISsample吗?%n%n按 [是] 则完全删除 %1 以及它的所有组件;%n按 [否]则让软件继续留在您的电脑上.
;定义解压说明
;StatusExtractFiles=解压并复制主程序文件及相关库文件...

11 [INI]

用于在用户系统中创建,修改或删除ini文件健值

[INI]
Filename: "{app}\cfg.ini"; Section: "Startup Options"; Flags: uninsdeletesection
Filename: "{app}\cfg.ini"; Section: "Startup Options"; Key: "server ip"; String: "127.0.0.1"
Filename: "{app}\cfg.ini"; Section: "Startup Options"; Key: "server port"; String: "8080"

12 [Registry]

用于在用户系统中创建,修改或删除注册表健值

[Registry]
Root: HKLM ;SubKey:"Software\ISsample";ValueType:dword;ValueName:config;ValueData:10 ;Flags:uninsdeletevalue

13 [code]

在执行脚本

[code]
//全局变量
var MyProgChecked: Boolean;

//判断程序是否存在
//初始华程序事件
function InitializeSetup(): boolean;
var Isbl: boolean;         //声明变量
var Isstr: string;
begin       //开始
Isbl := true;             //变量赋值
Isstr := "欢迎";
if RegValueExists(HKEY_LOCAL_MACHINE, "SOFTWARE\ISsample", "config") then
begin
    MsgBox("已安装过,请先卸载在安装",mbConfirmation, MB_OK);
    isbl := false;
end else
begin
   //MsgBox("无值",mbConfirmation, MB_OK);
     isbl := true;
end;

//下一步 按钮按钮 事件

//获取本机的IP地址
ip:string;
rtn:boolean;

//{083565F8-18F0-4F92-8797-9AD701FCF1BF}视网卡而定见LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards处
rtn :=RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Services\{083565F8-18F0-4F92-8797-9AD701FCF1BF}\Parameters\TcpIp','IpAddress', ip);
if (not rtn) or (ip='0.0.0.0') or (ip='') then ip := '127.0.0.1';

//系统环境变量操作

//根据环境变量选择组件

 

下面就是一个完整的.iss脚本文件。

; 脚本由 Inno Setup 脚本向导 生成!
; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!

#define MyAppName "考试系统_客户端"
#define MyAppVersion "1.0"
#define MyAppPublisher ""
#define MyAppURL "http://www.example.com/"
#define MyAppExeName "考试系统_客户端.exe"

[Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
AppId={{0410A33D-B345-43EA-BC66-8B674BC6A9E6}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\exam
;DefaultGroupName=zjt
OutputBaseFilename=考试系统_客户端
Compression=lzma
SolidCompression=yes
;可以让用户忽略选择语言相关
ShowLanguageDialog=yes

[Languages]
Name: "chs"; MessagesFile: "compiler:Default.isl"
Name: "en"; MessagesFile: "compiler:Languages\English.isl"

[Types]
Name: Full ;Description:"完全安装"; Flags: iscustom
Name: Compact ;Description:"简洁安装";
Name: Custom; Description:"自定义安装";

[Components]
Name: c1; Description: "自定义任务3" ; Types: Full
Name: a1; Description: "安装Components_1"; Types: Full Compact Custom ;
Name: a2; Description: "安装Components_2"; Types : Full   Compact
Name: a3; Description: "安装Components_3"; Types : Full
Name: a; Description: a 
Name: b; Description: b 

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "Tasks_1" ; Description:"用户自定义任务1"; Flags: unchecked
Name: "Tasks_2" ; Description:"用户自定义任务2"; Flags: unchecked
;选择了组件才会出现的定制任务
Name: "Tasks_3" ; Description:"用户自定义任务3";Components: c1 ; Flags: unchecked
;支持包含 not、and 和 or 操作
Name: p; Description: a or b; Components: a or b 
Name: q; Description: a and b; Components: a and b 
Name: r; Description: not a or b; Components: not a or b 
Name: s; Description: not (a or b); Components: not (a or b) 
Name: t; Description: a or b - old style; Components: a b

[Files]
;多语言安装环境设置    公共参数Languages 来设置
Source: "F:\exam\l_cn.txt"; DestDir: "{app}"; Languages: en ; Flags: ignoreversion
Source: "F:\exam\l_en.txt"; DestDir: "{app}"; Languages: chs ; Flags: ignoreversion
;用户自定义任务 Tasks
Source: "F:\exam\tasks_1.txt"; DestDir: "{app}\Tasks"; Flags: ignoreversion ;Tasks : Tasks_1
Source: "F:\exam\tasks_2.txt"; DestDir: "{app}\Tasks"; Flags: ignoreversion ;Tasks :Tasks_2
;用户定义组件安装
Source: "F:\exam\Components_1.txt"; DestDir: "{app}\Components"; Flags: ignoreversion ; Components: a1;
Source: "F:\exam\Components_2.txt"; DestDir: "{app}\Components"; Flags: ignoreversion ; Components: a2;
Source: "F:\exam\Components_3.txt"; DestDir: "{app}\Components"; Flags: ignoreversion ; Components: a3;
Source: "F:\exam\Components_4.txt"; DestDir: "{app}\Components"; Flags: ignoreversion ; Components: a1 a2 a3;
Source:"F:\exam\1.bat";DestDir:"{app}";Flags:igNoreversion recursesubdirs createallsubdirs
Source:"F:\exam\exam.ico";DestDir:"{app}";Flags:igNoreversion recursesubdirs createallsubdirs

[Icons]
Name: "{userdesktop}\test";Filename: "{app}\1.bat"; WorkingDir: "{app}"; IconFilename: "{app}\exam.ico";
Name: "{commondesktop}\test"; Filename: "{app}\1.bat"; Tasks: desktopicon 
Name: "{group}\test"; Filename: "{app}\1.bat"
Name: "{group}\{cm:ProgramOnTheWeb,test}"; Filename: "{app}\1.bat"
Name: "{group}\{cm:UninstallProgram,test}"; Filename: "{uninstallexe}"

[Run]
Filename: "{app}\1.bat";
;Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName,
参考地址:https://zhuanlan.zhihu.com/p/168690637

标签:总结,Tasks,Name,Setup,Flags,Components,Inno,app,Description
From: https://www.cnblogs.com/ITjyLh/p/18021105

相关文章

  • 关于代码性能优化的总结
    今天同事发开中遇到了一个代码性能优化的问题,原本需求是:从一个数据库中查询某个表数据,存放到datatable中,然后遍历datatable,看这些数据在另一个数据库的表中是否存在,存在的话就要更新,不存在就要插入。就这个需求本身来说很简单,但是随着数据量的增大,之前通过循环遍历的方式......
  • 第十六节:各种排序算法总结和性能测试
    一.        二.        三.         !作       者:Yaopengfei(姚鹏飞)博客地址:http://www.cnblogs.com/yaopengfei/声     明1:如有错误,欢迎讨论,请勿谩骂^_^。声     明2:原创博客请在转载......
  • 15. C++类中成员变量的初始化总结
    C++类中成员变量的初始化总结1.普通的变量:一般不考虑啥效率的情况下可以在构造函数中进行赋值。考虑一下效率的可以再构造函数的初始化列表中进行。classCA{public:intdata;public:CA();};/*********/CA::CA():data(0)//……#1……初始化列表方式{......
  • 每日总结
    ScalaIF...ELSE语句ScalaIF...ELSE语句是通过一条或多条语句的执行结果(True或者False)来决定执行的代码块。可以通过下图来简单了解条件语句的执行过程:if语句if语句有布尔表达式及之后的语句块组成。语法if语句的语法格式如下:if(布尔表达式){//如果布尔表达......
  • 【总结】HTML+JS逆向混淆混合
    国外的题果然考的与众不同[secrypt_cen.html]这次是HTML网页,然后JS加密判断翻看JS代码很显然,关键的代码在checkPasswordJS混淆是必备的去混淆一条龙走起先将关键代码提取出来 JavaScript function_0x4857(_0x398c7a,_0x2b4590){const_0x104914= _0x25ec(......
  • stm32芯片的SPI接口调试总结之轮询模式
    一概念1组成SPI系统可直接与各个厂家生产的多种标准外围器件接口,它只需4条线:串行时钟线(SCK)、主机输入/从机输出数据线(MISO)、主机输出/从机输入数据线(MOSI)和低电平有效的从机选择线(NSS)。(1)MISO:主设备输入/从设备输出引脚。该引脚在从模式下发送数据,在主模式下接收数......
  • MySQL字符串截取总结:Left()、Right()、Substring()、Substring_index()
    在实际的项目开发中有时会有对数据库某字段截取部分的需求,这种场景有时直接通过数据库操作来实现比通过代码实现要更方便快捷些,mysql有很多字符串函数可以用来处理这些需求,如Mysql字符串截取总结:left()、right()、substring()、substring_index()。一.从左开始截取字符串用法:le......
  • 双塔模型总结
    双塔模型介绍由于进入召回/粗排的候选数目比精排多很多,召回/粗排无法做的很精排一样复杂。现在业内比较通用的方案是采用双塔模型,左边塔建模userembedding,右边塔建模itemembedding,由于用户的行为经常发生变化,usertower需要经常更新,但是item状态很少发生变化,可以离线算好所有的......
  • 排序算法总结
    冒泡排序稳定排序时间复杂度o(n2)空间复杂度o(1)点击查看代码staticvoidBubbleSort(){int[]data={1,8,5,7,9,4,6,99,88,74};inti,j,flag;//岗哨模式的冒泡排序for(i=data.Length-1;i>0......
  • 2.17集训总结
    今天上午干的树形dp,全部干完了,最后一题#选课待复盘。下午整理五个基础dp,相当于整理了一下午改错本,我解决了3个dp,整理的自己相对满意。这是我的整理。晚上在AcWing上打了一次周赛,第一题大水,轻松ac,这次周赛比上次要简单些,但第二题打了一个小时还是有3个样例没过。衡实饭就是好吃,听......