# 列出指定进程名的监听端口
netstat -aon | findstr $(Get-Process adb -ErrorAction SilentlyContinue).Id
0..100 | % { Start-Sleep 1 ; netstat -aon | ? { $_ -like '*5432*' -and $_ -like '*ESTABLISHED*' } | measure | % Count }
# 端口对应的进程
netstat -aon | ? { $_ -like '*1235*' } | % { if( $_ -match '\d+\W*$' ){$Matches[0]} } | % { Get-Process -Id $_ }