操作步骤

1.找到Tomcat根目录的/bin/service.bat文件。
2.在文件前端添加如下。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

...

rem ---------------------------------------------------------------------------
rem NT Service Install/Uninstall script
rem
rem Options
rem install Install the service using Tomcat8 as service name.
rem Service is installed using default settings.
rem remove Remove the service from the System.
rem
rem name (optional) If the second argument is present it is considered
rem to be new service name
rem ---------------------------------------------------------------------------

setlocal

set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_152
set JRE_HOME=C:\Program Files\Java\jdk1.8.0_152\jre

set "SELF=%~dp0%service.bat"
rem Guess CATALINA_HOME if not defined

...


在windows中安装tomcat服务参考:
DOS TOMCAT 操作:https://chanchifeng.com/2018/11/11/tomcat-server/