Car*_*tem 4 windows network-adapter command-line
在 Windows 任务管理器中,有一个方便的网络选项卡,其中显示已连接网络适配器的链接速度和网络利用率(以可用带宽的百分比表示):
有没有办法通过命令行获取这些信息?
有(大量?)命令行选项提供有关网络使用情况的信息。 这涉及到这个问题,那里的答案与当前的操作有很大的重叠。其中许多不提供 OP 中要求的带宽使用百分比。
上面给出了Wireshark的选项。
typeperf
(Windows 原生)也很相关,有几个选项。
typeperf -q "Network Interface"
列出所有对象。然后,使用typeperf "\Network Interface(*)\...
以下选项:
\Network Interface(*)\Current Bandwidth
\Network Interface(*)\Bytes Total/sec
\Network Interface(*)\Bytes Received/sec
\Network Interface(*)\Bytes Sent/sec
\Network Interface(*)\Packets/sec
\Network Interface(*)\Packets Received/sec
\Network Interface(*)\Packets Sent/sec
Run Code Online (Sandbox Code Playgroud)
请注意,公式为((Total Bytes/Sec * 8)/current bandwidth) * 100
. 其他有用的选项:
\Network Interface(*)\Packets Received Unicast/sec
\Network Interface(*)\Packets Received Non-Unicast/sec
\Network Interface(*)\Packets Received Discarded
\Network Interface(*)\Packets Received Errors
\Network Interface(*)\Packets Received Unknown
\Network Interface(*)\Packets Sent Unicast/sec
\Network Interface(*)\Packets Sent Non-Unicast/sec
\Network Interface(*)\Packets Outbound Discarded
\Network Interface(*)\Packets Outbound Errors
\Network Interface(*)\Output Queue Length
\Network Interface(*)\Offloaded Connections
Run Code Online (Sandbox Code Playgroud)
可以使用flag -sc <samples>
(指定要采集的样本数量,默认是采集数据直到按下CTRL+C),参见官方文档。
标志-o <filename>
(指定输出文件或 SQL 数据库的路径。默认为 STDOUT(写入命令窗口)。)也可能有用。
这里给出了一个有趣的脚本,可以对其进行定制以提供各种信息并对其进行格式化。
无需通过 PowerShell 安装任何内容即可完成此操作。
您可以使用以下命令查看每个适配器的总速度和名称:
Get-NetAdapter
Run Code Online (Sandbox Code Playgroud)
然后,您可以将该名称放入唯一的 ID 中,然后使用以下命令查看传入流量的数量:
Get-Counter "\Network Interface(<unique id>)\Bytes Received/sec"
Run Code Online (Sandbox Code Playgroud)
如果您想要传出流量或总流量,请使用:
Get-Counter "\Network Interface(<unique id>)\Bytes Sent/sec"
Get-Counter "\Network Interface(<unique id>)\Bytes Total/sec"
Run Code Online (Sandbox Code Playgroud)
您还可以通过添加以下内容来衡量一段时间内的使用情况:
-SampleInterval 3 -MaxSamples 5
Run Code Online (Sandbox Code Playgroud)
请参阅帮助页面以获取更多信息。
归档时间: |
|
查看次数: |
18351 次 |
最近记录: |