Determine if Tomcat is running in Windows using the command prompt

后端 未结 10 1709
陌清茗
陌清茗 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 07:19

    Yet another option, since this is probably running as a service

    FOR /F "tokens=4 delims= " %%A IN ('SC QUERY tomcat5 ^| FIND "STATE"') DO SET status=%%A
    echo "%status%"
    

    status can be things like STOPPED, RUNNING ...

提交回复
热议问题