用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文件)(的更多相关文章

  1. 用Inno Setup制作WEB程序安装包

    原文 用Inno Setup制作WEB程序安装包 最近做了一个WEB程序的安装包,我把制作的过程做个介绍,贴出源码给大家做个参考 看看inno 的脚本 [Setup] AppCopyright=tes ...

  2. Inno Setup制作应用程序安装包

    我最近写了一个MFC应用程序,想发给其他的小伙伴玩一玩,直接发了个exe文件过去,结果发现小伙伴那边打不开.原来这个exe文件虽然是MFC静态编译的,但是还依赖了其他几个.dll文件,需要把这几个dl ...

  3. [Azure DevOps] 使用 Inno Setup 制作桌面软件安装包

    1. 桌面应用程序的 CI/CD 桌面应用程序的 CI/CD 过程和网站有一些不同,毕竟桌面应用程序的"部署"只是将安装包分发到目标位置,连应用商店都不用上,根据公司的管理流程可以 ...

  4. 用inno Setup制作web项目安装包

    http://www.cnblogs.com/xionghui/archive/2012/03/22/2411207.html 用inno Setup制作安装包 新建一个文件夹exambody,放ap ...

  5. nsis安装包_示例脚本语法解析

    以下是代码及解析,其中有底色的部分为脚本内容. 注释.!define.变量.!include.常量 ; Script generated by the HM NIS Edit Script Wizar ...

  6. 【原创】VB6.0应用程序安装包的生成(Setup Factory 9.0制作安装包的方法)

    VB6.0应用程序安装包的生成,利用其自带的打包工具生成的安装程序很简陋,一点不美观:如果想让自己的应用程序安装的时候显得高大上一点,本教程提供使用Setup Factory 9.0制作安装包的方法. ...

  7. Mac OS平台下应用程序安装包制作工具Packages的使用介绍

    一.介绍 Windows下面开发好的应用程序要进行分发时有很多打包工具可供选择,如Inno Setup, InstallShield, NSIS, Advanced Installer, Qt Ins ...

  8. 使用Inno Setup 打包.NET程序,并自动安装.Net Framework

    使用Inno Setup 打包.NET程序,并自动安装.Net Framework http://www.cnblogs.com/xiaogangqq123/archive/2012/03/19/24 ...

  9. 【程序打包工具 Inno Setup】CreateProcess 失败:代码 740(Inno Setup打包的程序提升为管理员权限)

    原文参考 https://www.cnblogs.com/SnailProgramer/p/4243666.html http://blog.csdn.net/x356982611/article/d ...

随机推荐

  1. 浅析Linux下进程间通信:共享内存

    浅析Linux下进程间通信:共享内存 共享内存允许两个或多个进程共享一给定的存储区.因为数据不需要在客户进程和服务器进程之间复制,所以它是最快的一种IPC.使用共享内存要注意的是,多个进程之间对一给定 ...

  2. 修改eclipse中settings.xml和默认资源库保存地址

    1.打开eclipse 2.window-->references-->Maven0-->User Settings:修改User Settings,Browse重新选择新位置D:\ ...

  3. python学习之路-day4-装饰器&json&pickle

    本节内容 迭代器&生成器 装饰器 Json & pickle 数据序列化 一.生成器 1.列表生成式 >>> L = [x * x for x in range(10 ...

  4. [Linux]CentOS下安装和使用tmux

    前天随意点开博客园,看到了一篇关于tmux的文章 Tmux - Linux从业者必备利器,特意还点进去看了.毕竟Linux对于做游戏服务端开发的我来说,太熟悉不过了.不过我就粗略地看了一眼,就关掉了. ...

  5. 关于.NET(c#)引用Dll后,找不到命名空间的问题

    最近做了一个Silverlight项目,一个类库引用DLL后,找不到命名空间.于是各种google,方法如下: 1.类库与DLL的目标框架不一致: 2.删除obj下文件和清空bin下文件: 3.重装系 ...

  6. SparkContext的初始化(叔篇)——TaskScheduler的启动

    <深入理解Spark:核心思想与源码分析>一书前言的内容请看链接<深入理解SPARK:核心思想与源码分析>一书正式出版上市 <深入理解Spark:核心思想与源码分析> ...

  7. 数论 : 模运算法则(poj 1152)

    题目:An Easy Problem! 题意:求给出数的最小进制. 思路:暴力WA: discuss中的idea: 给出数ABCD,若存在n 满足 (A* n^3 +B*n^2+C*n^1+D*n^0 ...

  8. SQL 修改列名

    exec sp_rename 'student.Ssex','Sex','column'; 执行后就可达到目的. 即是运用了 exec sp_rename '表明.原列名','新列名','column ...

  9. ubuntu 启动项创建器 选择不了CD镜像,IOS镜像的解决方法

    自己系统是ubuntu14.04 , 想使用 ubuntu自带的启动项创建器(usb-creator-gtk)做一个CDLinux的U盘启动项, 打开程序后发现U盘识别了, 在添加镜像的时候,发现怎么 ...

  10. tomee.xml

    部署 <?xml version="1.0" encoding="UTF-8"?> <tomee> <!-- see http:/ ...