使用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

相关推荐
程序猿熊跃晖13 小时前
解决 MyBatis-Plus 中 `update.setProcInsId(null)` 不生效的问题
数据库·tomcat·mybatis
WannaRunning18 小时前
浅谈Tomcat数据源连接池
java·oracle·tomcat
兢兢业业的小白鼠1 天前
Java高级JVM知识点记录,内存结构,垃圾回收,类文件结构,类加载器
java·开发语言·jvm·tomcat
chushiyunen1 天前
tomcat使用笔记、启动失败但是未打印日志
java·笔记·tomcat
杉之2 天前
SpringBlade 数据库字段的自动填充
java·笔记·学习·spring·tomcat
心灵宝贝2 天前
Tomcat 部署 Jenkins.war 详细教程(含常见问题解决)
java·tomcat·jenkins
生命是有光的2 天前
【中间件安全计划】锚定Tomcat安全基线
安全·中间件·tomcat
qq_431510162 天前
tomcat组件概览
java·tomcat
ccc_9wy3 天前
玄机-第六章 流量特征分析-常见攻击事件 tomcat的测试报告
网络安全·tomcat·玄机靶场·攻击流程·溯源分析·定时任务反弹shell·gobuster
当归10243 天前
Tomcat中的webapps的访问方式和java -jar内置Tomcat的访问方式的区别
java·tomcat·jar