如何找出 Windows 上哪个进程正在侦听 TCP 或 UDP 端口? [英] How can you find out which process is listening on a TCP or UDP port on Windows?

查看:130
本文介绍了如何找出 Windows 上哪个进程正在侦听 TCP 或 UDP 端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Windows 上找出哪个进程正在侦听 TCP 或 UDP 端口?

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

推荐答案

New answer, powershell

TCP

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

UDP

Get-Process -Id (Get-NetUDPEndpoint -LocalPort YourPortNumberHere).OwningProcess

旧答案,cmd

 C:\> netstat -a -b

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

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

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

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

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

-a Displays all connections and listening ports.

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

-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 以数字形式显示地址和端口号.

-n Displays addresses and port numbers in numerical form.

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

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

这篇关于如何找出 Windows 上哪个进程正在侦听 TCP 或 UDP 端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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