如何在Windows中使用localhost上的端口杀死当前进程?

编程入门 行业动态 更新时间:2024-10-25 07:25:57
本文介绍了如何在Windows中使用localhost上的端口杀死当前进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何删除已分配给端口的当前进程/应用程序?

How can I remove the current process/application which is already assigned to a port?

例如:localhost:8080

推荐答案

步骤1:

打开cmd.exe(注意:您可能需要以管理员身份运行它,但这并不总是必需的),然后运行以下命令:

Open up cmd.exe (note: you may need to run it as an administrator, but this isn't always necessary), then run the below command:

netstat -ano | findstr :PORT_NUMBER

(用所需的端口号替换PORT_NUMBER,但保留冒号)

(Replace PORT_NUMBER with the port number you want, but keep the colon)

以红色圈出的区域显示PID(过程标识符).找到正在使用所需端口的进程的PID.

The area circled in red shows the PID (process identifier). Locate the PID of the process that's using the port you want.

第2步:

下一步,运行以下命令:

Next, run the following command:

taskkill /PID PORT_NUMBER /F

(这次没有冒号)

最后,您可以通过重新运行步骤1"中的命令来检查操作是否成功.如果操作成功,您将不会再看到该端口号的搜索结果.

Lastly, you can check whether the operation succeeded or not by re-running the command in "Step 1". If it was successful you shouldn't see any more search results for that port number.

更多推荐

如何在Windows中使用localhost上的端口杀死当前进程?

本文发布于:2023-11-17 11:47:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1609909.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:端口   进程   如何在   localhost   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!