---
title: "网速批处理"
author: "yshlin"
date: "2014-02-21T11:33:04Z"
tags: ["网络", "速度"]
categories: ["操作系统"]
slug: "untitled"
draft: false
lastmod: "2014-02-21T11:33:04Z"
id: 1738104
url: "https://yshlin.iteye.com/blog/1738104"
---

```
@echo off
:run
for /F "tokens=2" %%i in ('netstat -e ^| find "Bytes"') do set down1=%%i
for /F "tokens=3" %%i in ('netstat -e ^| find "Bytes"') do set up1=%%i
ping -w 850 -n 1 1.1.1.1 2>nul >nul
for /F "tokens=2" %%i in ('netstat -e ^| find "Bytes"') do set /a down=(%%i-%down1%)/1024
for /F "tokens=3" %%i in ('netstat -e ^| find "Bytes"') do set /a up=(%%i-%up1%)/1024
cls
echo Down %down% KB
echo Up   %up% KB
title %down% KB Down %up% KB Up
goto:run
```