首页 > 代码库 > windows 批处理ping ip

windows 批处理ping ip

//pingSingleIp

;;
@Echo off
@for /f "tokens=1-4 delims=." %%i in (ip.txt) do (@ping -w 600 -n 1 %%i.%%j.%%k.%%l|find /i "超时" &&( date /t >>%%i.%%j.%%k.%%l.txt & echo %time:~0,-3% >>%%i.%%j.%%k.%%l.txt & echo %%i.%%j.%%k.%%l Timed Out >> %%i.%%j.%%k.%%l.txt & echo off))
echo.&echo 扫描完毕,按任意键退出...&pause>nul

 

//pingIpSegments

;;
@Echo off
@for /f "tokens=1-4 delims=." %%i in (ip.txt) do (@for /l %%n in (1,1,5) do @ping -w 600 -n 1 %%i.%%j.%%k.%%n|find /i "超时" &&(date /t >>%%i.%%j.%%k.%%n.txt & echo %time:~0,-3% >>%%i.%%j.%%k.%%n.txt & echo %%i.%%j.%%k.%%n Timed Out >> %%i.%%j.%%k.%%n.txt & echo off))
echo.&echo 扫描完毕,按任意键退出...&pause>nul

windows 批处理ping ip