- 帖子
- 14
- 积分
- 24
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2018-11-12
|
2楼
发表于 2021-9-22 12:09
| 只看该作者
只能查到全部流量,没找到如何查某个接口的。执行的第一次显示不准,后面每秒执行1次的数据是准确的。
@echo off
setlocal enabledelayedexpansion
set Received=0
set Sent=0
oop
for /f "tokens=1,2" %%a in ('wmic path Win32_PerfRawData_Tcpip_TCPv4 get SegmentsReceivedPersec^,SegmentsSentPersec^|findstr "[0-9]"') do (
set /a ReceivedPerSecond=%%a-!Received!
set /a SentPerSecond=%%b-!Sent!
set Received=%%a
set Sent=%%b
)
echo 接收:%ReceivedPerSecond% KB/s
echo 发送:%SentPerSecond% KB/s
timeout 1 >nul
goto Loop |
|