@echo off
set "ip=192.168.1.1"
set "inter=False"
set /a cout=0
:StartPing
set /a cout+=1
echo,第(%cout%)次测试 ip【%ip%】是否连通!
ping -n 1 "%ip%" | find "TTL" 1>nul 2>nul && set "inter=True"
if "%inter%"=="False" (
if %cout% equ 10 (
echo,***********************************
echo,ip【%ip%】网络无法联通
echo,***********************************
goto:end
)
echo,------- 失败 -------
goto StartPing
)else (
echo,***********************************
echo,ip【%ip%】网络通畅!!!!
echo,***********************************
goto:end
)
:end
pause&exit |