你怎么知道在Windows上正在侦听哪个进程?(How can you find out which process is listening on a port on Windows?)

编程入门 行业动态 更新时间:2024-10-25 08:21:37
你怎么知道在Windows上正在侦听哪个进程?(How can you find out which process is listening on a port on Windows?)

你怎么知道在Windows上正在侦听哪个进程?

How can you find out which process is listening on a port on Windows?

最满意答案

C:\> netstat -a -b

(添加-n以阻止它尝试解析主机名,这将使其快得多)

注意Dane对TCPView的建议。 看起来很有用!

-a显示所有连接和侦听端口。

-b显示创建每个连接或侦听端口时涉及的可执行文件。 在某些情况下,众所周知的可执行文件托管多个独立组件,在这些情况下,会显示创建连接或侦听端口所涉及的组件序列。 在这种情况下,可执行文件名称位于底部的[]中,顶部是它所调用的组件,依此类推,直到TCP / IP达到。 请注意,此选项可能很耗时,除非您有足够的权限,否则将失败。

-n以数字形式显示地址和端口号。

-o显示与每个连接相关联的拥有进程ID。

PowerShell

Get-Process -Id (Get-NetTCPConnection -LocalPort portNumber).OwningProcess

cmd

C:\> netstat -a -b

(Add -n to stop it trying to resolve hostnames, which will make it a lot faster.)

Note Dane's recommendation for TCPView. It looks very useful!

-a Displays all connections and listening ports.

-b Displays the executable involved in creating each connection or listening port. In some cases well-known executables host multiple independent components, and in these cases the sequence of components involved in creating the connection or listening port is displayed. In this case the executable name is in [] at the bottom, on top is the component it called, and so forth until TCP/IP was reached. Note that this option can be time-consuming and will fail unless you have sufficient permissions.

-n Displays addresses and port numbers in numerical form.

-o Displays the owning process ID associated with each connection.

更多推荐

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

发布评论

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

>www.elefans.com

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