wh123wh123 当前离线
六级士官
@echo off setlocal EnableDelayedExpansion :top ping -n 1 www.baidu.com | find /I "TTL" && goto top echo 网络不通 goto top复制代码
TOP
77七 当前离线
中校
@echo off setlocal enabledelayedexpansion ::设置尝试次数 set "imax=500" :top set/a "i+=1, k=0" for /f "delims=" %%v in ('ping -n 1 www.baidu.com ^|find /i "TTL" ') do ( set "k=1" &(echo,%%v !i!) ) if !k! equ 0 (echo,!i! 网络不通) if !i! geq !imax! (endlocal&exit/b) goto top复制代码
aloha20200628 当前离线
上尉
@echo off setlocal enabledelayedexpansion ::设置尝试次数 set "imax=5" :top set/a "i+=1, k=0" for /f "delims=" %%v in ('ping -n 1 www.baidu.com ^|find /i "TTL" ') do ( set "k=1" &(echo,%%v !i!) ) if !k! equ 0 (echo,!i! 网络不通) if !i! geq !imax! (endlocal&exit/b) goto top复制代码
pd1 当前离线
五级士官
<# : @echo off powershell -NoProfile -ExecutionPolicy bypass "Get-Content -literal '%~f0' |Out-String|Invoke-Expression" pause #> $n=1 while($true){ $result=ping -n 1 www.baidu.com if($result.Length -eq 40){"网络不通"} else{$result|?{$_.contains("TTL")}|%{$_+" "+$n;$n=$n+1;sleep 1} } }复制代码
@Echo Off rem http://www.bathome.net/redirect.php?goto=findpost&ptid=1246&pid=164208 SetLocal EnableDelayedExpansion :loop (For /F "delims=" %%i In ('ping -n 1 www.baidu.com ^| find /I "TTL"') Do ( set /a n+=10001 Set L1=%%i Echo !L1:~0,45! [ !n:~-4! ] )) || ( set /a n+=10001 set str=网络不通 echo !str:~0,50! [ !n:~-4! ] ) timeout 1 >nul goto :loop复制代码