当前位置: 首页 > news >正文

简易WLAN上传下载查看器by批处理

测试环境:windows10

使用方法:

1.新建记事本另存,文件类型所有文件,编码ansi,名称上传下载查看器.bat。

2.双击运行。

3.有问题反馈。

原理:

使用Get-NetAdapterStatistics获取WLAN时间段内的接收和发送字节计算获取速度。

@echo off
setlocal enabledelayedexpansion
title 上传下载查看器by phenix,邮箱279682817@qq.com
call :main
:main
set startDate=
set duration=0
set startRecValue=0
set startSenValue=0
set endRecValue=0
set endSenValue=0
set showMsg=
for /f "tokens=*" %%a in ('powershell -command "& {date}"') do (
set startDate='%%a'
)
rem echo !startDate!
for /f "skip=3 tokens=1,2,3,4* delims= " %%b in ('start /wait /b powershell -command "& {Get-NetAdapterStatistics|format-table -property name,receivedbytes,sentbytes}"') do (
if "%%b" equ "WLAN" (
set startRecValue=%%c
set startSenValue=%%d
)
)
rem echo !startRecValue!
rem echo !startSenValue!
for /f "tokens=1,2* delims=:" %%i in ('powershell -command "& {$d1=[datetime]!startDate!;$d2=date;$d2-$d1|format-list -property seconds}"') do (
set duration=%%j
if "!duration!" equ "0" (
set duration=1
)
)
rem echo !duration!
for /f "skip=3 tokens=1,2,3,4* delims= " %%f in ('start /wait /b powershell -command "& {Get-NetAdapterStatistics|format-table -property name,receivedbytes,sentbytes}"') do (
if "%%f" equ "WLAN" (
set endRecValue=%%g
set endSenValue=%%h
)
)
rem echo !endRecValue!
rem echo !endSenValue!
for /f "tokens=*" %%k in ('powershell -command "& {$recValue=[bigint]!endRecValue!-[bigint]!startRecValue!;([bigint]($recValue/[bigint]!duration!)).toString('n0')|foreach-object {$_}}"') do (
set showMsg=下载速度:%%k字节/秒,
)
for /f "tokens=*" %%l in ('powershell -command "& {$senValue=[bigint]!endSenValue!-[bigint]!startSenValue!;([bigint]($senValue/[bigint]!duration!)).toString('n0')|foreach-object {$_}}"') do (
set showMsg=!showMsg!上传速度:%%l字节/秒,
)
echo !showMsg!
powershell -command "& {start-sleep -seconds 1}"
cls
goto :main

相关文章:

  • 95套HTML高端大数据可视化大屏源码分享
  • AI与软件工程结合的未来三年发展路径分析
  • AI对软件工程的影响及未来发展路径分析报告
  • ARXML解析与可视化工具
  • ToolsSet之:渐变色生成工具
  • 复刻真实世界的虚拟系统Goal
  • 漏洞Reconfigure the affected application to avoid use of weak cipher suites. 修复方案
  • Ts中的 可选链操作符
  • 【笔记】Suna 部署之 Supabase 数据库 schema 暴露操作
  • 【Doris基础】Doris中的Tablet详解:核心存储单元的设计与实现
  • 【笔记】Windows 系统安装 Supabase CLI 完整指南(基于 Scoop)
  • 解决开发者技能差距:AI 在提升效率与技能培养中的作用
  • C#定时器深度对比:System.Timers.Timer vs System.Threading.Timer性能实测与选型指南
  • 基于LBS的上门代厨APP开发全流程解析
  • 专业课复习笔记 11
  • Chrome插件学习笔记(二)
  • 【AI非常道】二零二五年五月,AI非常道
  • 软件架构基础
  • 计算机模拟生物/化学反应有哪些软件?
  • 特伦斯 S75 电钢琴:奏响极致音乐体验的华丽乐章
  • 设计类专业网站有哪些/营销培训视频课程免费
  • 如何做网站毕业设计/郑州做网站推广哪家好
  • 做婚庆的网站/怎么建个人网站
  • 房山区网站建设/公司网站建设费用多少
  • 手机网站建设技术/产品推广方案怎么写
  • 安装Wordpress个人网站/营销型网站建设易网拓