首页 > 技术文章 > windows系统h2服务快捷启动方式

xhj123 2020-03-20 22:34 原文

最近在使用h2服务,本地启动了下,感觉每次在命令行输入命令太麻烦,所以写了一个bat脚本,放在桌面上,用来启动服务,内容如下:

 

redisStartUp.bat:

@echo off

if "%H2_JAR%" == "" goto startDirectly

if "%H2_JAR%" == "%cd%" goto startDirectly

:: require to configure the environment variable "H2_JAR"
%H2_JAR:~0,2%

:startDirectly

:: start redis sentinels
:: start /b java -cp "%H2_JAR%" org.h2.tools.Server -web -webAllowOthers -tcp -tcpPort 19200 -tcpAllowOthers
java -cp "%H2_JAR%" org.h2.tools.Server -web -webAllowOthers -tcp -tcpPort 19200 -tcpAllowOthers &

 

需要依赖本地安装jdk,配置jdk环境变量,并且需要配置h2 jar包的位置:

 

这样把redisStartUp.bat放在桌面上,就可以快速地启动服务了,tcp服务端口为19200,http服务端口为8082

推荐阅读