用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:=0 to GetArrayLength(Guid_names)-1 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客户端。’ #13#13 ‘您是否要卸载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’)<>0 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(256);
Form.ClientHeight := ScaleY(100);
Form.Caption := ‘密码验证’;
Form.BorderIcons := [biSystemMenu];
Form.BorderStyle := bsDialog;
Form.Center;

OKButton := TButton.Create(Form);
OKButton.Parent := Form;
OKButton.Width := ScaleX(75);
OKButton.Height := ScaleY(23);
OKButton.Left := Form.ClientWidth - ScaleX(75 + 6 + 75 + 50);
OKButton.Top := Form.ClientHeight - ScaleY(23 + 10);
OKButton.Caption := ‘确定’;
OKButton.ModalResult := mrOk;
OKButton.Default := true;

CancelButton := TButton.Create(Form);
CancelButton.Parent := Form;
CancelButton.Width := ScaleX(75);
CancelButton.Height := ScaleY(23);
CancelButton.Left := Form.ClientWidth - ScaleX(75 + 50);
CancelButton.Top := Form.ClientHeight - ScaleY(23 + 10);
CancelButton.Caption := ‘取消’;
CancelButton.ModalResult := mrCancel;
CancelButton.Cancel := True;

PwdEdit := TPasswordEdit.Create(Form);
PwdEdit.Parent := Form;
PwdEdit.Width := ScaleX(210);
PwdEdit.Height := ScaleY(23);
PwdEdit.Left := ScaleX(23);
PwdEdit.Top := ScaleY(23);

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:=0 to GetArrayLength(Guid_names)-1 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。’ #13#13 ‘您是否要卸载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’)<>0 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(256);
Form.ClientHeight := ScaleY(100);
Form.Caption := ‘密码验证’;
Form.BorderIcons := [biSystemMenu];
Form.BorderStyle := bsDialog;
Form.Center;

OKButton := TButton.Create(Form);
OKButton.Parent := Form;
OKButton.Width := ScaleX(75);
OKButton.Height := ScaleY(23);
OKButton.Left := Form.ClientWidth - ScaleX(75 + 6 + 75 + 50);
OKButton.Top := Form.ClientHeight - ScaleY(23 + 10);
OKButton.Caption := ‘确定’;
OKButton.ModalResult := mrOk;
OKButton.Default := true;

CancelButton := TButton.Create(Form);
CancelButton.Parent := Form;
CancelButton.Width := ScaleX(75);
CancelButton.Height := ScaleY(23);
CancelButton.Left := Form.ClientWidth - ScaleX(75 + 50);
CancelButton.Top := Form.ClientHeight - ScaleY(23 + 10);
CancelButton.Caption := ‘取消’;
CancelButton.ModalResult := mrCancel;
CancelButton.Cancel := True;

PwdEdit := TPasswordEdit.Create(Form);
PwdEdit.Parent := Form;
PwdEdit.Width := ScaleX(210);
PwdEdit.Height := ScaleY(23);
PwdEdit.Left := ScaleX(23);
PwdEdit.Top := ScaleY(23);

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做应用程序安装包的示例脚本(.iss文件)(

    用innoSetup做应用程序安装包的示例脚本(.iss文件),具体要看innoSetup附带的文档,好象是pascal语言写的脚本. 示例1(应用程序.exe,客户端安装): ;{089D6802- ...

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

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

  3. Inno Setup 5.5.3 安装包制作工具

    Inno Setup 5.5.3  安装包制作工具 点击 图标,运行 Inno Setup 编译器,在弹出的"欢迎"对话框中点击"取消".如下图. 来到 Inn ...

  4. jar包使用exe4j打成可双击运行的.exe文件和使用Inno Setup Compiler生成.exe安装包教程

    一.工具下载与准备 1.exe4j下载地址:链接:https://pan.baidu.com/s/156dLCKpIRDQdUZxKKvWjqA 提取码:q6fx 2.Inno Setup Compi ...

  5. Inno Setup Compiler 美化定制安装包

    其他 Inno Setup Compiler 打包技巧见 Python程序打包指南    此脚本在<互联网风格安装程序.wangwenx190>的基础上,按需进行了修改,期间参考了很多大牛 ...

  6. 用inno setup做的安装程序,安装过程中被360报如下风险

    用inno setup做的安装程序,安装过程中被360报如下风险,请问大家有碰到过没有? 我看了下,好像就是最后生成卸载程序时报出来的,在将setup.tmp拷到unins000.exe时,360认为 ...

  7. C#软件winform程序安装包制作

    转自:http://jingyan.baidu.com/article/b2c186c8e26f2ac46ef6ff3a.html 使用vs2010 winform程序开发的软件的人比较多,程序的开发 ...

  8. C#软件winform程序安装包制作及卸载程序制作

    使用vs2010 winform程序开发的软件的人比较多,程序的开发是为了在不同的人不同的机器使用,为了使不同的机器能使用该软件就需要在制作程序安装包,安装包里必须包含该软件运行所选的所有环境,下面就 ...

  9. linux程序安装包怎么用,制作Linux下程序安装包——使用脚本打包bin、run等安装包...

    制作简单的安装包的时候可以简单的用cat命令连接两个文件,然后头部是脚本文件,执行的时候把下面的文件分解出来就行了.一般这个后部分的文件是个压缩 包,那样,就能够打包很多文件了,在脚本中解压出来即可. ...

最新文章

  1. codevs1183 泥泞的道路(01分数规划)
  2. C# 实现将 PDF 转文本的功能
  3. Jmeter简介以及简单模拟性能测试
  4. RestTemplate入门案例
  5. for 循环 and while 循环(二)
  6. PLY——Python Lex Yacc
  7. 算法导论 25.3 Johnson算法
  8. des加密 lua_lua-resty-nettle实现des解密
  9. 文章集合--作者篇--上【转】
  10. 3K水稻SNP数据集的简单利用
  11. 50万VPN登录凭证遭泄露,中国占11.89%
  12. 2020电工(初级)考试题及电工(初级)模拟考试系统
  13. 散论陈寅恪先生《对科学院的答复》
  14. iptables拦截域名_使用iptables封锁对某个域名的DNS查询
  15. 打破 Dockershim 移除焦虑,且看Rancher 如何应对
  16. symbian模拟器试用到期后的处理办法
  17. 人工智能基础复习1——人工智能概述
  18. rsync+sersync实时同步数据
  19. 根据输入的三角形的三条边的值,判断三角形的类型(等边、等腰、直角、普通、非三角形)并输出
  20. 如果你有一台M1 Mac,那你可以拥有Touch ID的妙控键盘!

热门文章

  1. 多卡聚合路由器5G+4G是什么意思
  2. 吊打面试官、分享这份MySQL开发魔典,从入门到通关白皮书
  3. 【图像超分辨率重建】——“SISR 中的Edge-Based 损失函数”论文精读
  4. 网站盈利的10种方式
  5. go语言初学者常见错误
  6. unity基础学习之基础语义
  7. 悟空出行携手融创文化梦之城、哈弗品牌,融合战略发布会圆满落幕
  8. mysql高可用架构——MMM用群集架构
  9. 计算机信息管理面试自我介绍,信息管理专业的面试自我介绍
  10. POS签购单上的授权号,凭证号,参考号,批次号,分别是什么?有什么作用?