带有进程名称的netstat?

Roy*_*mir 57 windows-7 powershell netstat cmd.exe

使用netstat -a -o -n 我可以获得端口和PID的列表

然后我需要去任务管理器并添加PID,看看它是谁。(相当令人沮丧)

在此处输入图片说明

我想知道是否有一个 CMD 命令可以完成这一切(使用find, for, powershell

这样我就可以得到进程名称

and*_*415 70

解决方案

使用-b参数:

  -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.
Run Code Online (Sandbox Code Playgroud)

注意netstat -b除非从提升的命令提示符运行,否则该命令将失败。

解决方法

过滤进程列表并找到您感兴趣的 PID:

tasklist | findstr /c:"PID"  
Run Code Online (Sandbox Code Playgroud)


替代解决方案

你可以Tcpvcon.exe改用。不需要管理员权限。

Tcpvcon 的用法类似于内置的 Windowsnetstat实用程序。

Usage: tcpvcon [-a] [-c] [-n] [process name or PID]

 -a Show all endpoints (default is to show established TCP connections).
 -c Print output as CSV.
 -n Don't resolve addresses.
Run Code Online (Sandbox Code Playgroud)


Lep*_*tor 9

我认为您正在寻找来自 SysInternals 的TCPView