功能强大的打包工具 Inno Setup

Inno Setup 下载地址

vscode code.iss

帮助文档

官网

此功能包含

  • 欢迎界面
  • 注册协议界面
  • 组件界面
  • 安装目录界面
  • 完成界面
  • 卸载界面

支持

  • 压缩比最优化
  • 批量文件夹
  • 启动外部三方程序
  • 安装第三方完成并删除
  • 安装完成后启动程序
  • 附加图标
  • 卸载面板显示安装空间大小
  • 卸载
  • 检测系统位数安装
  • 支持重复安装提示

不支持

说明

脚本文件使用的是编码格式是 GB2312
拖动脚本到 "D:\Program Files (x86)\Inno Setup 6\Compil32.exe" 自动编译
示例文件下载
打开 ChineseSimplified.isl 可以看到最下面有自定义Section,可以任意修改添加删除

inno.gif

源码

  ; Script generated by the Inno Setup Script Wizard.
  ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
  
  # define MyAppName "快乐至上科技发展有限公司"
  # define MyAppVersion "1.0.0"
  # define MyAppPublisher "TopHappy.cn"
  # define MyAppURL "http://www.happytop.cn/"
  # define MyAppExeName "TxMainApp.exe"
  # define MyVersionInfoVersion "3.0.0.0"

  [Setup]
  ; NOTE: The value of AppId uniquely identifies this application.
  ; Do not use the same AppId value in installers for other applications.
  ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
  AppId={06CF67B3-AF31-4940-8D25-7DA0FD99389C}
  AppName={#MyAppName}
  AppVersion={#MyAppVersion}
  ;AppVerName={#MyAppName} {#MyAppVersion}
  AppPublisher={#MyAppPublisher}
  AppPublisherURL={#MyAppURL}
  AppSupportURL={#MyAppURL}
  AppUpdatesURL={#MyAppURL}
  DefaultDirName={pf}\Happy\tx
  DefaultGroupName={#MyAppName}

  DisableWelcomePage=no
  OutputDir=D:\Desktop
  OutputBaseFilename=TxInstaller
  DisableProgramGroupPage=yes
  LicenseFile=D:\Happy\V3.0_TX\Installer\SoftwareLicence.txt
  SetupIconFile=D:\Happy\V3.0_TX\App.ico
  Compression=lzma
  SolidCompression=yes
  UninstallDisplayIcon={app}\{#MyAppExeName}
  VersionInfoVersion={#MyVersionInfoVersion}

  [Languages]
  Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"

  [Tasks]
  Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
  Name: "install_nmap"; Description: "安装 Nmanp Setup"; GroupDescription: "{cm:Other}";  Flags: checkablealone 
  Name: "install_hasp"; Description: "安装 HASPUserSetup"; GroupDescription: "{cm:Other}"; Flags: checkablealone 

  [Files]
  Source: "D:\Happy\Test\main\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
  Source: "D:\Happy\Installer\HASPUserSetup.exe"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall; Tasks :install_hasp
  Source: "D:\Happy\Installer\nmap-7.12-setup.exe"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall ;Tasks :install_nmap
  Source: "D:\Happy\Installer\dotNet4.5-x86-x64.3505182529.exe"; DestDir: "{app}"; Flags: ignoreversion deleteafterinstall ;

  [Icons]
  Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
  Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon

  [Run]
  Filename: "{app}\{#MyAppExeName}"; Description: "启动 {#MyAppName}"; Flags: postinstall skipifsilent
  Filename: "{app}\nmap-7.12-setup.exe"; StatusMsg: "安装 Nmanp Setup"; Check: IsWin64(); Tasks: install_nmap;
  Filename: "{app}\HASPUserSetup.exe"; StatusMsg: "安装 HASPUserSetup"; Check: IsWin64(); Tasks: install_hasp;
  Filename: "{app}\dotNet4.5-x86-x64.3505182529.exe"; StatusMsg: "安装 dotNet4.5-x86-x64.3505182529.exe"; Check: IsWin64();

  [Code]
  function InitializeSetup(): boolean;
  var
  ResultStr, SubKeyName: String;
  ResultCode: Integer;
  begin
  if (IsWin64()) then begin
  SubKeyName := 'Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{06CF67B3-AF31-4940-8D25-7DA0FD99389C}_is1';
      RegQueryStringValue(HKLM64,SubKeyName,'UninstallString',ResultStr);
      end else begin
  SubKeyName := 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{06CF67B3-AF31-4940-8D25-7DA0FD99389C}_is1';
      RegQueryStringValue(HKLM32,SubKeyName,'UninstallString',ResultStr);
      end;

  ResultStr := RemoveQuotes(ResultStr);
  Exec(ResultStr, '', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
  result := true;
  end;

  procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
  begin
  if CurUninstallStep = usDone then
      begin
      DelTree(ExpandConstant('{app}'), True, True, True);
      end;
  end;