如何显示tcpvcon.exe(Windows10)特定进程打开连接的端口号?

How to display the port numbers of open connections for a specific process with tcpvcon.exe (Windows 10)?

我的 Windows 10 机器上有 TCPView 和 Tcpvcon,我想知道如何在 Tcpvcon 程序的输出中获取 TCPView 中显示的所有信息(端口号等)? TCPView 在其向 GUI 的输出中包含进程名称、PID、协议、远程地址、远程端口等。另一方面,Tcpvcon 仅包含进程名称、协议、远程和本地地址。我想在 Tcpvcon 的命令行输出中获得所有可以在 TCPView GUI 中读取的信息(尤其是端口号)。 Tcpvcon 似乎只有三个开关 -a -c -n 但无论我如何组合它们,我都没有达到我的目标。谁能帮帮我?

下面是我使用所有三个开关时的示例输出。在 TCPView 中,我看到了有关指定进程的更多信息。

我也很惊讶 tcpvcon 没有显示端口号(也许我们应该请 Mark R. 添加它们 ;-)

但是你可以使用

netstat -a -o -n

或与管理员 shell 甚至

netstat -a -o -n -b

开关含义:

-a ... Displays all active TCP connections and the TCP and UDP ports 
       on which the computer is listening.

-o ... Displays active TCP connections and includes the process ID (PID)
       for each connection.

-n ... Displays active TCP connections, however, addresses and port numbers 
       are expressed numerically and no attempt is made to determine names.

-b ... Displays the executable involved in creating each connection or 
       listening port. (Note that this option can be time-consuming and 
       will fail unless you have sufficient permissions.)

要获得所有可用的开关,只需使用 netstat -?(还有其他有趣的开关)或 https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/netstat

swobi

在 2011 版 TCPVCON 之前,它用于显示端口信息。

较新的版本不再存在。

如果你能拿到 2.54 版,你就能得到端口信息。

使用 tcpvcon-v2.34(我找不到 2.54)进行测试,它显示端口但不显示进程,所有连接都显示为来自 System.还缺少 TCPV6 和 UDPV6。

这是一个例子:

C:\WINDOWS\system32>"C:\My Program Files\TCPView-v4.13\tcpvcon-v2.34.exe" -a -c
TCP,System,-1,LISTENING,WXP-OR7507156:epmap,WXP-OR7507156:0
TCP,System,-1,LISTENING,WXP-OR7507156:microsoft-ds,WXP-OR7507156:0
TCP,System,-1,LISTENING,WXP-OR7507156:sms-rcinfo,WXP-OR7507156:0
TCP,System,-1,LISTENING,WXP-OR7507156:5040,WXP-OR7507156:0
TCP,System,-1,LISTENING,WXP-OR7507156:wsd,WXP-OR7507156:0
..
UDP,System,-1,,192.168.56.1:137,*:*
UDP,System,-1,,192.168.56.1:138,*:*
UDP,System,-1,,192.168.56.1:2177,*:*
UDP,System,-1,,192.168.56.1:5353,*:*

编辑: 我纠正自己。 ASB 是对的。 我刚拿到 TCPView v2.54,它确实显示了应用程序、端口以及 TCPV6 和 UDPV6。

所以我确认“好的”版本是 v2.54。

Tcpvcon.exe -a -c

TCPView v2.54 - TCP/UDP endpoint viewer
Copyright (C) 1998-2009 Mark Russinovich
Sysinternals - www.sysinternals.com

TCP,dnscrypt-proxy.exe,4188,LISTENING,WXP-XXX:domain,WXP-XXX:0
TCP,[System Process],0,TIME_WAIT,WXP-XXX:domain,localhost:62240
..
UDP,Teams.exe,12632,*,WXP-XXX:58950,*:*
TCPV6,svchost.exe,1232,LISTENING,wxp-XXX:135,wxp-XXX:0
..
UDPV6,svchost.exe,19712,*,wxp-XXX:50836,*:*
UDPV6,System,4,*,wxp-XXX:56736,*:*