用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 ...
随机推荐
- 自动布局之autoresizingMask
UIViewAutoresizing是一个枚举类型,默认是UIViewAutoresizingNone,也就是不做任何处理. 1 2 3 4 5 6 7 8 9 typedef NS_OPTIONS( ...
- sessionFactory
SessionFactory接口:SessionFactory接口负责初始化Hibernate.它充当数据存储源的代理,并负责创建Session对象.这里用到了工厂模式.需要注意的是SessionFa ...
- IIS访问提示您不具备查看该目录或页面的权限,因为访问控制列表 (ACL) 对 Web 服务器上的该资源进行了配置
1. 检查IIS权限,webmail目录权限. 2. 在本地安全策略中,设置从网络访问本地服务器与拒绝从网络访问本地服务器.中查看相关用户的权限 3. 如果上面的步骤还是有问题.使用下面的步骤进行设置 ...
- Centos7 php 5.6.19编译安装
0x01 前言 在php官网下载php-5.6.19.tar.gz源代码(php7虽然说性能提升很大,但是小菜菜还是先用着这个先吧),解压后根目录有个INSTALL文件,里面有安装教程了,目录如下: ...
- AutoResetEvent waitone set进一步理解补充
AutoResetEvent 的定义 //定义两个信号锁 AutoResetEvent ReadTxt = new AutoResetEvent(false); AutoResetEvent Uplo ...
- 使用事件等待句柄EventWaitHandler 实现生产者、消费者队列
using System; using System.Threading; using System.Collections.Generic; class ProducerConsumerQueue ...
- vi/vim学习
1.vi3中模式 一般模式.编辑模式.命令模式2.快捷操作 i.I插入:i在目前的光标所在处插入文字:I(大写i)在行首插入 a.A 增加:a由光标所在的下一个字开始输入:A由光标所在行的最后增加 o ...
- c# 身份证证号验证方法
#region 验证身份证是否有效 /// <summary> /// 验证身份证是否有效 /// </summary> ...
- 关于最近在做的一个js全屏轮播插件
最近去面试了,对方要求我在一个星期内用原生的js代码写一个全屏轮播的插件,第一想法就是跟照片轮播很相似,只是照片轮播是有定义一个宽高度大小已经确定了的容器用来存储所有照片,然后将照片全部左浮动,利用m ...
- Setting SVN Repository Using TortoiseSVN + Dropbox in 5 Minutes
SVN is a very common version control system in software development. However configuring SVN server ...