
[已解決]批處理如何ping最快的ip并顯示出來(lái)
- @echo off
- echo 8.8.8.8/bbs/index.php >>a.txt
- echo 192.168.1.1/bbs/index.php >>a.txt
- echo 10.10.10.10/bbs/index.php >>a.txt
- echo 137.0.57.94/bbs/index.php >>a.txt
- rem這里有至少6個(gè)ip地址要查看速度,ip地址固定,寫(xiě)入到a.txt記事本
- goto :sis
- rem 下面部分a.txt 帶入測(cè)試出最快的ip
- :sis
- setlocal enabledelayedexpansion
- set f=9999
- for %%i in (a.txt) do (
- for /f tokens=6 delims==, %%j in ('ping -n 1 %%i^|findstr Average') do (
- set s=%%j
- set /a s=!s:ms=!
- if !s! lss !f! set f=!s!&set ff=%%i))
- echo 最快的服務(wù)器是!ff!!f!ms
- rem 結(jié)果直接顯示的是a.txt
- rem 請(qǐng)各位幫忙解決一下,謝謝,不會(huì)用”tokens=6 delims==“
- pause
nclick="copycode($('code0'));">復(fù)制代碼
ip地址是固定的