用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 ...
随机推荐
- ios8以后,使用UIAlertViw时pop/push页面后,键盘闪一下的问题
代码为 UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"" message:@"感谢你对我们提出的意见或 ...
- 单片机TM4C123学习(七):I2C模块(温度传感器)
I2C(Inter Intergrated Circuit)总线是Philips公司推出的一种用于IC器件之间连接的二线制串行扩展总线,它通过两根信号线(SDA-串行数据线:SCL-串行时钟线)在连接 ...
- 【实(dou)力(bi)首(mai)发(meng)】第四次CCF软件能力认证题解
这次的题总体上相对前三次偏简单.由于实力有限,就分析前四题. 试题编号: 201503-1 试题名称: 图像旋转 时间限制: 5.0s 内存限制: 256.0MB 问题 ...
- socket方法
// 创建一个Socket实例var socket = new WebSocket('ws://192.168.2.72:8430'); // 打开Socket socket.onopen = fun ...
- UIWebView加载页面
在页面中 加载了一个webView 当点击该webView的页面 需要获取webView中的url. 在push出来的另一个页面中,重新初始化一个webView加载 下面这个方法 在webView加载 ...
- VS快捷键设置
设置VS快捷键,这里以关闭当前窗口为例子: 步骤: 1.tool=>option=>environment=>keyboard 2.百度关闭当前窗口的command是什么,百度出来是 ...
- 精妙SQL语句收集
SQL语句先前写的时候,很容易把一些特殊的用法忘记,我特此整理了一下SQL语句操作.(转) 一.基础 1.说明:创建数据库 CREATE DATABASE database-name 2.说明:删除数 ...
- 关系型数据库与NOSQL(转)
出处:http://www.cnblogs.com/chay1227/archive/2013/03/17/2964020.html 关系型数据库把所有的数据都通过行和列的二元表现形式表示出来. 关系 ...
- centos下安装iftop
CentOS 下iftop 的安装 安装方法一:编译安装(安装成功) wget http://ex-parrot.com/~pdw/iftop/download/iftop-0.17pre3.tar. ...
- iOS手势(滑动)返回的实现(自定义返回按钮)
如果各位使用的是storyboard布局的话,且用的是系统的返回按钮,那么是自动会有滑动返回效果的,但是相信各位做项目的,一般都是用的自定义的返回按钮,所以我贴几行代码,看看怎么实现系统自带的滑动返回 ...