【发布时间】:2016-12-20 07:00:27
【问题描述】:
我正在尝试获取所有处于正在侦听状态的本地端口。使用
netstat -a -n
我得到以下输出:
Proto Local Address Foreign Address State
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING //for example, demo data is given
但我只是不想得到端口号。
1111 //for ex, this is in listening state.
在 Windows 10 中,我可以使用
Get-NetTCPConnection -State Listen | group localport -NoElement
可行,但此命令在 Windows 7 上不可用
【问题讨论】:
标签: windows powershell windows-7 powershell-5.0