- @echo off
- MODE con: COLS=22 LINES=10
-
- for /f "tokens=2,3" %%i in ('netstat -e ^|findstr /i "Bytes 字节"') do (
- set rec=%%i
- set sent=%%j
- )
-
- :loop
- echo WScript.Sleep 1000 > "%temp%\tmp$.vbs"
- cscript //nologo "%temp%\tmp$.vbs"
- cls
-
- (for /f "tokens=2,3" %%i in ('netstat -e ^|findstr /i "Bytes 字节"') do (
- echo res=FormatNumber((%%i-%rec%^)*8/1024, 2, true^)
- echo sent=FormatNumber((%%j-%sent%^)*8/1024, 2, true^)
- echo WScript.Echo "下载流量:" ^& res ^& " kbits"
- echo WScript.Echo ""
- echo WScript.Echo "上传流量:" ^& sent ^& " kbits"
- set rec=%%i
- set sent=%%j
- )) > "%temp%\tmp$.vbs"
-
- cscript //nologo "%temp%\tmp$.vbs"
-
- goto :loop
复制代码
|