Determine if Tomcat is running in Windows using the command prompt

后端 未结 10 1746
陌清茗
陌清茗 2020-12-15 06:24

Quite simply, how does one determine whether or not Tomcat is running in Windows, using the command prompt?

I am writing a batch script that must do this. This is

10条回答
  •  感动是毒
    2020-12-15 06:59

    This is the Windows version of the netstat based UNIX/LINUX solution asked in the question:

    @echo off
    
    netstat -na | find "LISTENING" | find /C /I ":8080" > NUL
    if %errorlevel%==0 goto :running
    
    echo tomcat is not running
    goto :eof
    
    :running
    echo tomcat is running
    
    :eof
    

提交回复
热议问题