实例

  • 根据进程ID(PID)查看某进程的所有 TCP 连接
# cmd
# 6540 为 PID
netstat -ano | findstr TCP.*6540$

netstat

  • 根据 PID 查看某进程的所有 TCP 连接,并按创建时间排序
# powershell
Get-NetTCPConnection -OwningProcess 6540 | 
Sort-Object CreationTime | 
Format-Table Local*, Remote*, State, CreationTime 

Get-NetTCPConnection

# 用 Where-Object 过滤掉临时端口(Bound)
Get-NetTCPConnection -OwningProcess 6540 | 
Where-Object {$_.State -ne 'Bound'} | 
Sort-Object CreationTime | 
Format-Table Local*, Remote*, State, CreationTime   

Where-Object

本文出自 qbit snap

qbit
268 声望279 粉丝