1.Inno Setup Compiler软件介绍
Inno Setup Compiler是一个.exe程序打包工具,可将程序的目录文件重新打包成exe程序,进行二次安装,并且能在执行安装后运行部分命令
2.官网下载及汉化
地址:https://jrsoftware.org/isdl.php
中文汉化文件:ChineseSimplified
3.配置文件示例(npc程序打包配置文件)
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "LaoDing内网穿透"
#define MyAppVersion "1.5"
#define MyAppPublisher "laoding.me"
#define MyAppURL "https://laoding.me/"
#define MyAppExeName "npc.exe"
#define MyAppAssocName MyAppName + " File"
#define MyAppAssocExt ".myp"
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
[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={{EA8D119B-0037-4C5A-9DAE-B4320C0471BC}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\npc
ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
ChangesAssociations=yes
DisableProgramGroupPage=yes
PrivilegesRequired=admin
OutputBaseFilename=LaoDing内网穿透(安装版)
Compression=lzma
SolidCompression=yes
WizardStyle=modern
SetupIconFile=npc.ico
UninstallDisplayName=卸载{#MyAppName}
UninstallDisplayIcon=D:\应用软件\npc打包\unnpc.ico
AppCopyright=www.laoding.me
OutputDir=D:\应用软件\npc打包\Output
[Languages]
Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "D:\应用软件\npc打包\npc.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "D:\应用软件\npc打包\conf\npc.conf"; DestDir: "{app}\conf"; Flags: ignoreversion recursesubdirs createallsubdirs
[Registry]
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocExt}\OpenWithProgids"; ValueType: string; ValueName: "{#MyAppAssocKey}"; ValueData: ""; Flags: uninsdeletevalue
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}"; ValueType: string; ValueName: ""; ValueData: "{#MyAppAssocName}"; Flags: uninsdeletekey
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\{#MyAppExeName},0"
Root: HKA; Subkey: "Software\Classes\{#MyAppAssocKey}\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExeName}"" ""%1"""
Root: HKA; Subkey: "Software\Classes\Applications\{#MyAppExeName}\SupportedTypes"; ValueType: string; ValueName: ".myp"; ValueData: ""
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon;
[Run]
; 先执行安装命令
Filename: "{app}\npc.exe"; Parameters: "install"; Flags: waituntilterminated
; 安装完成后再启动服务
Filename: "{app}\npc.exe"; Parameters: "start"; Flags: waituntilterminated
[UninstallRun]
; 卸载时停止并删除 Npc 服务
Filename: "sc.exe"; Parameters: "stop Npc"; Flags: runhidden waituntilterminated; RunOnceId: "StopNpcService"
Filename: "sc.exe"; Parameters: "delete Npc"; Flags: runhidden waituntilterminated; RunOnceId: "DeleteNpcService"
[UninstallDelete]
; 删除安装目录和所有文件
Type: filesandordirs; Name: "{app}"
示例配置文件:npc配置文件

