连接速度Windows XP的命令行带宽图

时间:2014-05-10 13:21:27

标签: batch-file command-line windows-xp netstat

我知道那里有很多带宽图。我想知道CMD是否可以生成测量带宽的图表。使用批处理文件来执行此操作。我看过网络,无法找到我想要的东西。我可以从netstat -e获取统计数据,但我正在寻找的是一个移动的图表。谢谢你的帮助。

1 个答案:

答案 0 :(得分:2)

这是一个小批量生成一个排序图表,您可以添加更多if语句来更改图表最大值。希望这有帮助。

@echo off
color 0b
MODE CON:COLS=16 LINES=3
title TCP Graph 30kb Max
:begin
for /F "tokens=10 delims=ms=," %%a in ('ping -n 1 -w 10000 -l 1024 8.8.8.8^| find "Average"') do set "P1=%%a"
netstat -e | find "Bytes" >NUL
for /F "tokens=2,3" %%a in ('netstat -e ^| find "Bytes"') do set "received1=%%a" & set "sent1=%%b"
sleep 1
netstat -e | find "Bytes" >NUL
for /F "tokens=2,3" %%a in ('netstat -e ^| find "Bytes"') do set "received2=%%a" & set "sent2=%%b"
set /a r1=%received1%
set /a r2=%received2%
set /a s1=%sent1%
set /a s2=%sent2%
set /a q1=%r2%-%r1%
set /a a1=%q1%
set /a q2=%s2%-%s1%
set /a a2=%q2%
set /a q3=%a1%+%a2%
set /a a3=%q3%
set /a q4=%a3%/1024
set /a a4=%q4%
if %a3% gtr 0 ( echo      %a4% kb/s  & echo. )
if %a3% gtr 2048 ( echo      %a4% kb/s  & echo *              )
if %a3% gtr 4096 ( echo      %a4% kb/s  & echo **             )
if %a3% gtr 6144 ( echo      %a4% kb/s  & echo ***            )
if %a3% gtr 8192 ( echo      %a4% kb/s  & echo ****           )
if %a3% gtr 10240 ( echo      %a4% kb/s  & echo *****          )
if %a3% gtr 12288 ( echo      %a4% kb/s  & echo ******         )
if %a3% gtr 14336 ( echo      %a4% kb/s  & echo *******        )
if %a3% gtr 16384 ( echo      %a4% kb/s  & echo ********       )
if %a3% gtr 18432 ( echo      %a4% kb/s  & echo *********      )
if %a3% gtr 20480 ( echo      %a4% kb/s  & echo **********     )
if %a3% gtr 22528 ( echo      %a4% kb/s  & echo ***********    )
if %a3% gtr 24576 ( echo      %a4% kb/s  & echo ************   )
if %a3% gtr 26624 ( echo      %a4% kb/s  & echo *************  )
if %a3% gtr 28672 ( echo      %a4% kb/s  & echo ************** )
if %a3% gtr 30720 ( echo      %a4% kb/s  & echo ***************)
goto begin