본문 바로가기

Test Code/Batch

ping 배치파일

배치파일로 IP를 변경해가며 ping test를 한후 성공한 IP 만 out.txt로 저장한다.



 rem pingtest.bat 


set ip=192.100.0 if exist "out.txt" ( del "out.txt" ) for /L %%i in (1,1,255) do ( ping %ip%.%%i -n 1 -w 1 | findstr "TTL" >> out.txt )

type out.txt

pause


** ping 옵션

-n : ping 횟수

-w : Timeout