杀死运行在任何端口上的 tomcat 服务,Windows
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42084188/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Kill tomcat service running on any port, Windows
提问by Suraj Shingade
Kill tomcat service running on any port, Windows using command promt like 8080/ 8005
杀死运行在任何端口上的 tomcat 服务,Windows 使用像 8080/8005 这样的命令提示符
回答by Suraj Shingade
1) Go to (Open) Command Prompt (Press Window+ Rthen type cmdRun this).
1)转到(打开)命令提示符(按Window+ R然后键入cmdRun this)。
2) Run following commands
2)运行以下命令
For all listening ports
对于所有监听端口
netstat -aon | find /i "listening"
netstat -aon | 找到 /i “听”
Apply port filter
应用端口过滤器
netstat -aon |find /i "listening" |find "8080"
netstat -aon |find /i "listening" |find "8080"
Finally with the PID we can run the following command to kill the process
3) Copy PID from result set
最后使用 PID 我们可以运行以下命令来终止进程
3) 从结果集中复制 PID
taskkill /F /PID
taskkill /F /PID
Ex: taskkill /F /PID 189
例如:taskkill /F /PID 189
Sometimes you need to run Command Prompt with Administrator privileges
有时您需要以管理员权限运行命令提示符
Done !!! you can start your service now.
完毕 !!!你现在可以开始你的服务了。
回答by Piyush Bansal
Based on all the info on the post, I created a little script to make the whole process easy.
根据帖子中的所有信息,我创建了一个小脚本来简化整个过程。
@ECHO OFF
netstat -aon |find /i "listening"
SET killport=
SET /P killport=Enter port:
IF "%killport%"=="" GOTO Kill
netstat -aon |find /i "listening" | find "%killport%"
:Kill
SET killpid=
SET /P killpid=Enter PID to kill:
IF "%killpid%"=="" GOTO Error
ECHO Killing %killpid%!
taskkill /F /PID %killpid%
GOTO End
:Error
ECHO Nothing to kill! Bye bye!!
:End
pause