使用inno将tomcat打包成exe安装包(可以提示重复安装)

; Script generated by the Inno Setup Script Wizard.

; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "BBG002"

#define MyAppVersion "1.2"

#define MyAppPublisher "BBG002"

#define MyAppURL "http://localhost:8080/"

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={{86D79F54-E485-4011-83FE-FFC558F3DB93}

AppName={#MyAppName}

AppVersion={#MyAppVersion}

;AppVerName={#MyAppName} {#MyAppVersion}

AppPublisher={#MyAppPublisher}

AppPublisherURL={#MyAppURL}

AppSupportURL={#MyAppURL}

AppUpdatesURL={#MyAppURL}

DefaultDirName={pf}\{#MyAppName}

DefaultGroupName={#MyAppName}

OutputBaseFilename=BBG002_V1.2_INS

SetupIconFile=D:\testexe\favicon.ico

Compression=lzma

SolidCompression=yes

Languages

Name: "english"; MessagesFile: "compiler:Default.isl"

Files

Source: "D:\testexe\environment\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

Run

Filename: "{app}\environment.bat";

Registry

;将安装路径写入注册表

Root: HKCU; Subkey: "SOFTWARE\bbg002\config"; Flags: createvalueifdoesntexist

Root: HKCU; Subkey: "SOFTWARE\bbg002\config"; Flags: uninsdeletekeyifempty

Root: HKCU; Subkey: "SOFTWARE\bbg002\config"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"

Root: HKCU; Subkey: "SOFTWARE\bbg002\config"; ValueType: string; ValueName: "Version"; ValueData: "{#MyAppVersion}"

Root: HKCU; Subkey: "SOFTWARE\bbg002\config"; ValueType: dword; ValueName: "VersionNum"; ValueData: "100"

Root: HKCU; Subkey: "SOFTWARE\bbg002\config"; ValueType: string; ValueName: "Release Date"; ValueData: "2024/03/25"

Code

//初始化时执行

function InitializeSetup(): Boolean;

var

Version: string;

strPath: string;

ResultCode: Integer;

begin

Result:= TRUE;

//read the version

if RegQueryStringValue(HKEY_CURRENT_USER, 'SOFTWARE\bbg002\config', 'Version', Version) then

begin

// Successfully read the value

Version := '检测到已经安装了软件,请勿重复安装';

MsgBox(Version, mbConfirmation,MB_YESNO)

Result:= FALSE;

end;

end;

timeout /t 3 /nobreak >nul

unins000.exe

reg delete HKEY_CURRENT_USER\SOFTWARE\bbg002\config /f

unins000.exe

相关推荐
XS0301061 天前
【无标题】
java·tomcat·maven·intellij-idea
Yan_chen6661 天前
Vulhub 靶场:Tomcat8 弱口令与 WAR 包上传漏洞复现
java·网络安全·靶场·tomcat·文件上传漏洞
wang09072 天前
自己动手写一个tomcat之7监听器和过滤器
java·tomcat
TechExplorer3652 天前
Tomcat 下载与安装
java·tomcat
程序员良辰3 天前
【TongWeb7的M11】 首次登录密码修改 & 开启控制台远程访问
java·中间件·tomcat
凯酱3 天前
MyBatis 中 OGNL 的使用:从入门到实战
java·tomcat·mybatis
Linux-lucky4 天前
28-Linux学习之旅之Maven与Nexus制品库
linux·运维·学习·nginx·tomcat·maven
竹枝溪6 天前
Tomcat与Servlet全套小白教程
java·servlet·tomcat·cookie·filter·session·listener
choumou_M6 天前
SpringBoot_2:MyBatis-Generator插件使用教程
spring boot·tomcat·mybatis
SQL-First布道者9 天前
持久层框架的评价标准:只有一个
java·spring boot·spring·tomcat·mybatis·spring jdbc