用inno Setup做应用程序安装包的示例脚本(.iss文件)(
用innoSetup做应用程序安装包的示例脚本(.iss文件),具体要看innoSetup附带的文档,好象是pascal语言写的脚本。
示例1(应用程序.exe,客户端安装):
;{089D6802-6CD3-4E45-B8D5-AC9ED99CE371}; 脚本由 Inno Setup 脚本向导生成!
; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档! [Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
AppId={{5E012E21-42EE-4840-A000-35F9FAB886E9}
AppName=AIS_Client
AppVerName=AIS_Client
AppPublisher=公司名 DefaultDirName={pf}\AIS_Client
DefaultGroupName=AIS_Client
OutputBaseFilename=AIS_Client
Compression=lzma
SolidCompression=yes
SetupIconFile=D:\AIS\AIS 打包程序\AISGUI.ico
LicenseFile=C:\Documents and Settings\Administrator\桌面\许可协议.txt [Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Default.isl" [Files]
Source: "D:\AIS\AIS 打包程序\AIS_client_exe\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion” [Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}" [Icons]
Name: "{group}\AIS客户端"; Filename: "{app}\AISGUI.exe"
Name: "{group}\AIS客户端参数配置工具"; Filename: "{app}\ClientConfig.exe"
Name: "{group}\AIS服务设置工具"; Filename: "{app}\ServiceIPManage.exe"
Name: "{group}\AIS数据库参数配置工具"; Filename: "{app}\DataBaseConfig.exe"
;Name: "{group}\门控服务端"; Filename: "{app}\Access_server\SecurityWare.exe"
;在开始菜单->所有程序->伴网书童里添加一个删除快捷键。
Name: "{group}\卸载"; Filename: {uninstallexe}
Name: "{commondesktop}\AIS客户端"; Filename: "{app}\AISGUI.exe"; Tasks: desktopicon
;Name: "{commondesktop}\门控服务端"; Filename: "{app}\Access_server\SecurityWare.exe"; Tasks: desktopicon [Run]
;Filename: "{app}\Access_server\SecurityWare.exe"; Description: "{cm:LaunchProgram,AIS}"; Flags: nowait postinstall skipifsilent shellexec
Filename: "{app}\AISGUI.exe"; Description: "{cm:LaunchProgram,AIS}"; Flags: nowait postinstall skipifsilent shellexec [Registry]
;添加开机启动
Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName:"ais"; ValueData:"{app}\AISGUI.exe"; Flags:uninsdeletevalue [Code]
{卸载时判断主程序是否在运行}
var
is_Sys , is_value: integer;
S_syschar, S_currentchar, S_current,S_sys, S,ResultStr : string;
I ,CloseNum: Integer;
ErrorCode: Integer;
Guid_names,window_name : TArrayOfString;
bool : Boolean;
const AppName='{5E012E21-42EE-4840-A000-35F9FAB886E9}_is1'; {程序安装前判断主程序是否在运行}
function InitializeSetup(): Boolean;
var
ResultCode: Integer;
begin
if RegGetSubkeyNames(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',Guid_names) then
begin
for I:= to GetArrayLength(Guid_names)- do
begin
S := Guid_names[i];
//注册表中找到了此键
if AppName=Guid_names[i] then
begin
bool := RegQueryStringValue(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\'+S,'UninstallString',ResultStr);
//ResultStr := RemoveQuotes(ResultStr);
if bool then
begin
if MsgBox('安装程序检测到当前计算机已经安装了AIS客户端。' ## '您是否要卸载AIS客户端?', mbConfirmation, MB_YESNO) = IDYES then
// ShellExec('', ExpandConstant('{app}\unins000.exe'), '','', SW_SHOW, ewNoWait, ResultCode);
begin
Exec(RemoveQuotes(ResultStr), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
Result := false;
end
end
break;
end
else
//zdx 5.8 判断是否已经打开了一个安装程序
begin
if FindWindowbyWindowName('安装 - AIS_Client')<> then
begin
MsgBox('安装程序检测到有另外一个安装程序已经在运行了', mbConfirmation, MB_OK);
Result := false;
break;
end
end
end;
if I= GetArrayLength(Guid_names) then
Result := true;
end
else
Result := true;
end; //当用户单击cancel的时候,删除掉拷贝到系统的文件夹
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
end ; //卸载密码验证函数
function AskPassword(): Boolean;
var
Form: TSetupForm;
OKButton, CancelButton: TButton;
PwdEdit: TPasswordEdit;
begin
Result := false;
Form := CreateCustomForm();
try
Form.ClientWidth := ScaleX();
Form.ClientHeight := ScaleY();
Form.Caption := '密码验证';
Form.BorderIcons := [biSystemMenu];
Form.BorderStyle := bsDialog;
Form.Center; OKButton := TButton.Create(Form);
OKButton.Parent := Form;
OKButton.Width := ScaleX();
OKButton.Height := ScaleY();
OKButton.Left := Form.ClientWidth - ScaleX( + + + );
OKButton.Top := Form.ClientHeight - ScaleY( + );
OKButton.Caption := '确定';
OKButton.ModalResult := mrOk;
OKButton.Default := true; CancelButton := TButton.Create(Form);
CancelButton.Parent := Form;
CancelButton.Width := ScaleX();
CancelButton.Height := ScaleY();
CancelButton.Left := Form.ClientWidth - ScaleX( + );
CancelButton.Top := Form.ClientHeight - ScaleY( + );
CancelButton.Caption := '取消';
CancelButton.ModalResult := mrCancel;
CancelButton.Cancel := True; PwdEdit := TPasswordEdit.Create(Form);
PwdEdit.Parent := Form;
PwdEdit.Width := ScaleX();
PwdEdit.Height := ScaleY();
PwdEdit.Left := ScaleX();
PwdEdit.Top := ScaleY(); Form.ActiveControl := PwdEdit; if Form.ShowModal() = mrOk then
begin
Result := PwdEdit.Text = 'bw12345678';
if not Result then
MsgBox('密码错误', mbInformation, MB_OK);
end;
finally
Form.Free();
end;
end; //卸载程序的时候判断是否在运行
function InitializeUninstall(): Boolean;
begin
begin
//密码验证
//Result := AskPassword();
Result := TRUE;
// DelTree(ExpandConstant('{app}\*'), False, True, True);
end
end; //提示卸载完后重启计算机
function UninstallNeedRestart(): Boolean;
begin
Result := False;
DelTree(ExpandConstant('{app}\*'), False, True, True);
DelTree(ExpandConstant('{app}'), True, True, True);
end;
示例2(windows service,服务端安装):
;{089D6802-6CD3-4E45-B8D5-AC9ED99CE371}; 脚本由 Inno Setup 脚本向导生成!
; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档! [Setup]
; 注: AppId的值为单独标识该应用程序。
; 不要为其他安装程序使用相同的AppId值。
; (生成新的GUID,点击 工具|在IDE中生成GUID。)
AppId={{D0D0B722-C6F9-4A89-AB56-1417B9BD1400}
AppName=AIS_Server
AppVerName=AIS_Server
AppPublisher=公司名 DefaultDirName={pf}\AIS_Server
DefaultGroupName=AIS_Server
OutputBaseFilename=AIS_Server
Compression=lzma
SolidCompression=yes
SetupIconFile=D:\AIS\AIS 打包程序\AISGUI.ico
LicenseFile=C:\Documents and Settings\Administrator\桌面\许可协议.txt [Languages]
Name: "chinesesimp"; MessagesFile: "compiler:Default.isl" [Files]
Source: "D:\AIS\AIS 打包程序\AIS_server_exe\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; 注意: 不要在任何共享系统文件上使用“Flags: ignoreversion” [Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}" [Icons]
Name: "{group}\AIS服务端参数配置工具"; Filename: "{app}\ServiceConfig.exe"
;Name: "{group}\AIS客户端"; Filename: "{app}\AIS_client_exe\AISGUI.exe"
;Name: "{group}\门控服务端"; Filename: "{app}\Access_server\SecurityWare.exe"
;在开始菜单->所有程序->伴网书童里添加一个删除快捷键。
Name: "{group}\卸载"; Filename: {uninstallexe}
;Name: "{commondesktop}\AIS客户端"; Filename: "{app}\AIS_client_exe\AISGUI.exe"; Tasks: desktopicon
;Name: "{commondesktop}\门控服务端"; Filename: "{app}\Access_server\SecurityWare.exe"; Tasks: desktopicon [Run]
;Filename: "{app}\Access_server\SecurityWare.exe"; Description: "{cm:LaunchProgram,AIS}"; Flags: nowait postinstall skipifsilent shellexec
;Filename: "{app}\AIS_client_exe\AISGUI.exe"; Description: "{cm:LaunchProgram,AIS}"; Flags: nowait postinstall skipifsilent shellexec [Registry]
;添加开机启动
;Root: HKLM; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName:"bwqc"; ValueData:"{app}\MSrv.exe"; Flags:uninsdeletevalue [Code]
{卸载时判断主程序是否在运行}
var
is_Sys , is_value: integer;
S_syschar, S_currentchar, S_current,S_sys, S,ResultStr : string;
I ,CloseNum: Integer;
ErrorCode: Integer;
Guid_names,window_name : TArrayOfString;
bool : Boolean;
const AppName='{D0D0B722-C6F9-4A89-AB56-1417B9BD1400}_is1'; {程序安装前判断主程序是否在运行}
function InitializeSetup(): Boolean;
var
ResultCode: Integer;
begin
if RegGetSubkeyNames(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall',Guid_names) then
begin
for I:= to GetArrayLength(Guid_names)- do
begin
S := Guid_names[i];
//注册表中找到了此键
if AppName = Guid_names[i] then
begin
bool := RegQueryStringValue(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\'+S,'UninstallString',ResultStr);
//ResultStr := RemoveQuotes(ResultStr);
if bool then
begin
if MsgBox('安装程序检测到当前计算机已经安装了AIS_Server。' ## '您是否要卸载AIS_Server?', mbConfirmation, MB_YESNO) = IDYES then
// ShellExec('', ExpandConstant('{app}\unins000.exe'), '','', SW_SHOW, ewNoWait, ResultCode);
begin
Exec(RemoveQuotes(ResultStr), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
Result := false;
end
end
break;
end
else
//zdx 5.8 判断是否已经打开了一个安装程序
begin
if FindWindowbyWindowName('安装 - AIS_Server')<> then
begin
MsgBox('安装程序检测到有另外一个安装程序已经在运行了', mbConfirmation, MB_OK);
Result := false;
break;
end
end
end;
if I = GetArrayLength(Guid_names) then
Result := true;
end
else
Result := true;
end; //当用户单击cancel的时候,删除掉拷贝到系统的文件夹
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
end ; //卸载密码验证函数
function AskPassword(): Boolean;
var
Form: TSetupForm;
OKButton, CancelButton: TButton;
PwdEdit: TPasswordEdit;
begin
Result := false;
Form := CreateCustomForm();
try
Form.ClientWidth := ScaleX();
Form.ClientHeight := ScaleY();
Form.Caption := '密码验证';
Form.BorderIcons := [biSystemMenu];
Form.BorderStyle := bsDialog;
Form.Center; OKButton := TButton.Create(Form);
OKButton.Parent := Form;
OKButton.Width := ScaleX();
OKButton.Height := ScaleY();
OKButton.Left := Form.ClientWidth - ScaleX( + + + );
OKButton.Top := Form.ClientHeight - ScaleY( + );
OKButton.Caption := '确定';
OKButton.ModalResult := mrOk;
OKButton.Default := true; CancelButton := TButton.Create(Form);
CancelButton.Parent := Form;
CancelButton.Width := ScaleX();
CancelButton.Height := ScaleY();
CancelButton.Left := Form.ClientWidth - ScaleX( + );
CancelButton.Top := Form.ClientHeight - ScaleY( + );
CancelButton.Caption := '取消';
CancelButton.ModalResult := mrCancel;
CancelButton.Cancel := True; PwdEdit := TPasswordEdit.Create(Form);
PwdEdit.Parent := Form;
PwdEdit.Width := ScaleX();
PwdEdit.Height := ScaleY();
PwdEdit.Left := ScaleX();
PwdEdit.Top := ScaleY(); Form.ActiveControl := PwdEdit; if Form.ShowModal() = mrOk then
begin
Result := PwdEdit.Text = 'bw12345678';
if not Result then
MsgBox('密码错误', mbInformation, MB_OK);
end;
finally
Form.Free();
end;
end; procedure CurStepChanged(CurStep: TSetupStep);//添加环境变量
var
ResultCode: Integer;
begin
if CurStep = ssPostInstall then
begin
ShellExec('', ExpandConstant('{app}\ServiceInstall.exe'),
'-is AIS_server "'+ ExpandConstant('{app}\AIS_server.exe')+'"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
end; procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
ResultCode: Integer;
begin
if CurUninstallStep = usUninstall then
begin
ShellExec('', ExpandConstant('{app}\ServiceInstall.exe'),
'-u AIS_server "'+ ExpandConstant('{app}\AIS_server.exe')+'"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
end;
end; //卸载程序的时候判断是否在运行
function InitializeUninstall(): Boolean;
begin
begin
//密码验证
//Result := AskPassword();
Result := TRUE;
// DelTree(ExpandConstant('{app}\*'), False, True, True);
end
end; //提示卸载完后重启计算机
function UninstallNeedRestart(): Boolean;
begin
Result := False;
DelTree(ExpandConstant('{app}\*'), False, True, True);
DelTree(ExpandConstant('{app}'), True, True, True);
end;
用inno Setup做应用程序安装包的示例脚本(.iss文件)(的更多相关文章
- 用Inno Setup制作WEB程序安装包
原文 用Inno Setup制作WEB程序安装包 最近做了一个WEB程序的安装包,我把制作的过程做个介绍,贴出源码给大家做个参考 看看inno 的脚本 [Setup] AppCopyright=tes ...
- Inno Setup制作应用程序安装包
我最近写了一个MFC应用程序,想发给其他的小伙伴玩一玩,直接发了个exe文件过去,结果发现小伙伴那边打不开.原来这个exe文件虽然是MFC静态编译的,但是还依赖了其他几个.dll文件,需要把这几个dl ...
- [Azure DevOps] 使用 Inno Setup 制作桌面软件安装包
1. 桌面应用程序的 CI/CD 桌面应用程序的 CI/CD 过程和网站有一些不同,毕竟桌面应用程序的"部署"只是将安装包分发到目标位置,连应用商店都不用上,根据公司的管理流程可以 ...
- 用inno Setup制作web项目安装包
http://www.cnblogs.com/xionghui/archive/2012/03/22/2411207.html 用inno Setup制作安装包 新建一个文件夹exambody,放ap ...
- nsis安装包_示例脚本语法解析
以下是代码及解析,其中有底色的部分为脚本内容. 注释.!define.变量.!include.常量 ; Script generated by the HM NIS Edit Script Wizar ...
- 【原创】VB6.0应用程序安装包的生成(Setup Factory 9.0制作安装包的方法)
VB6.0应用程序安装包的生成,利用其自带的打包工具生成的安装程序很简陋,一点不美观:如果想让自己的应用程序安装的时候显得高大上一点,本教程提供使用Setup Factory 9.0制作安装包的方法. ...
- Mac OS平台下应用程序安装包制作工具Packages的使用介绍
一.介绍 Windows下面开发好的应用程序要进行分发时有很多打包工具可供选择,如Inno Setup, InstallShield, NSIS, Advanced Installer, Qt Ins ...
- 使用Inno Setup 打包.NET程序,并自动安装.Net Framework
使用Inno Setup 打包.NET程序,并自动安装.Net Framework http://www.cnblogs.com/xiaogangqq123/archive/2012/03/19/24 ...
- 【程序打包工具 Inno Setup】CreateProcess 失败:代码 740(Inno Setup打包的程序提升为管理员权限)
原文参考 https://www.cnblogs.com/SnailProgramer/p/4243666.html http://blog.csdn.net/x356982611/article/d ...
随机推荐
- hibernate多表查询,结果封装在自己定义的一个实体类当中(在自己定义的类中增加构造函数)
hibernate的hql查询直接返回java对象时出现问题3 向大家请教一个问题,现在有三张表,表之间没有关联,我需要将三张表里面的所有东西查询出来存储到一个新的对象中,该如何实现,使用hibern ...
- 从DNS配置
从服务器可以从主服务器上抓取指定的区域数据文件起到备份解析记录和负载均衡的作用. 主DNS服务器IP:192.168.16.20 从DNS服务器IP:192.168.16.30 1,修改主服务器区域配 ...
- toString的理解
Super的作用: 1. super可以直接调用父类的属性和方法. 2. super可以在子类的构造器中调用父类的构造器. 我们知道:实例化一个对象时,会调用构造器. 我们发现,仅仅实例化的是Stud ...
- js-事件、正则表达式
AddEventListener()之中有三个参数,分别是(1)事件的名称(注:不要加on,例:click才是点击事件的名称)(2)需要执行的function(){} (3)布尔类型(false表示的 ...
- 【枚举】bzoj3391 [Usaco2004 Dec]Tree Cutting网络破坏
#include<cstdio> using namespace std; #define N 10001 int n; int v[N<<1],first[N],next[N ...
- C2第三次作业解题报告
看过题解后如果觉得还算有用,请帮忙加点我所在团队博客访问量 http://www.cnblogs.com/newbe/ http://www.cnblogs.com/newbe/p/4069834.h ...
- Rhythmbox中文乱码
今天在网络上找到了一个比较好的解决Rhythmbox中文乱码的问题的方法 进入你的音乐文件夹执行如下代码: mid3iconv -e GBK *.mp3 如果没有提示多试几次, 有可能系统会提示: p ...
- WebSphere试用过期问题处理
WebSphere Application Server的试用期为60天,过期将无法启动WAS. E:\IBM\WebSphere\AppServer\profiles\Dmgr01\bin>s ...
- java编程规范
一.规范存在的意义 应用编码规范对于软件本身和软件开发人员而言尤为重要,有以下几个原因: 1.好的编码规范可以尽可能的减少一个软件的维护成本 , 并且几乎没有任何一个软件,在其整个生命周期中,均由最初 ...
- Dynamic CRM 2013学习笔记(二十五)JS调用web service 实现多条记录复制(克隆)功能
前面介绍过如何克隆一条当前的记录: Dynamic CRM 2013学习笔记(十四)复制/克隆记录 , 主要是通过界面上加一个字段,单击form上的clone 按钮时,改变这个字段的值以触发插件来实现 ...