确定如果Tomcat在Windows中使用命令提示符下运行 [英] Determine if Tomcat is running in Windows using the command prompt

查看:563
本文介绍了确定如果Tomcat在Windows中使用命令提示符下运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很简单,一个人如何确定的Tomcat是否在Windows中运行,使用命令提示符?

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 the Bash version:

RESULT=`netstat -na | grep $2 | awk '{print $7}' | wc -l`

其中$ 2端口。

Where $2 is the port.

我要寻找类似的东西。使用 Cygwin的是出了问题,需要的这个脚本必须能够对机器,只有Tomcat的运行。

I am looking for something similar to that. Using Cygwin is out of the question, of necessity this script must be able to run on machines that only have Tomcat.

推荐答案

您可以使用任务列表来检查tomcat的可执行文件运行。例如:

You could use tasklist to check if the tomcat executable is running. For example:

@echo off
tasklist /FI "IMAGENAME eq tomcat.exe" | find /C /I ".exe" > NUL
if %errorlevel%==0 goto :running

echo tomcat is not running
goto :eof

:running
echo tomcat is running

:eof

也可以使用选项来检查删除服务器 / S / U / P 。参见任务列表/?了解详情。

这篇关于确定如果Tomcat在Windows中使用命令提示符下运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆