利用Procrun把jar包制作成window服务

原创
2020/07/30 08:51
阅读数 1.6K

installService.bat

@echo off
setlocal
set path=%cd%
rem prunsrv.exe
set exe=Sb.exe
rem SpringBoot.jar
set jar=Sb.jar
set ServiceName=SbService
set pr_DisplayName=SbService
set pr_Description=SpringBoot Service %jar%
set pr_Install=%path%\%exe%
set pr_Classpath=%path%\%jar%
set pr_JavaHome=D:\x5work\java\jre1.8-x64
set pr_JvmMs=512
set pr_JvmMx=2048
set pr_JvmSs=512
set pr_Jvm=auto
set pr_Startup=auto
set pr_StartMode=jvm
set pr_StartClass=org.springframework.boot.loader.JarLauncher
set pr_StartMethod=main
set pr_StopMode=jvm
set pr_StopClass=java.lang.System
set pr_StopMethod=exit
set pr_LogPath=%path%\log
rem 注册为windows服务
%path%\%exe% //IS//%ServiceName%
rem 启动服务
%path%\%exe% //ES//%ServiceName%
echo execute finished
pause

removeService.bat

@echo off
setlocal
set path=%cd%
rem prunsrv.exe
set exe=Sb.exe
set ServiceName=SbService
rem 卸载windows服务,如果服务启动会先停止服务
%path%\%exe% //DS//%ServiceName%
echo execute finished
pause

updateService.bat

@echo off
setlocal
set path=%cd%
rem prunsrv.exe
set exe=Sb.exe
rem SpringBoot.jar
set jar=sb-0.0.4-2020年07月23日14时30分43秒.jar
set ServiceName=SbService
set pr_DisplayName=SbService
set pr_Description=%jar%
set pr_Install=%path%\%exe%
set pr_Classpath=%path%\%jar%
rem 停止windows服务
%path%\%exe% //SS//%ServiceName%
rem 更新windows服务
%path%\%exe% //US//%ServiceName%
rem 启动服务
%path%\%exe% //ES//%ServiceName%
echo execute finished
pause
展开阅读全文
打赏
2
2 收藏
分享
加载中
更多评论
打赏
0 评论
2 收藏
2
分享
返回顶部
顶部