IaaS/기타

IP 대역 중 사용중인 IP확인하는 스크립트

armyost 2022. 11. 4. 15:49
728x90

Windows Batch 파일

 

@echo off

SET count=0
SET /p subnet=Please enter IP address range (example, 192.168.0)

:start
SET /a count=%count%+1

cls
ECHO. & ECHO Trying %subnet%.%count% & ECHO.

ping -n 1 -w 1000 %subnet%.%count% >nul 

IF %errorlevel%==0 echo %subnet%.%count% UP >> %cd%\%subnet%.log 
IF %errorlevel%==1 echo %subnet%.%count% DOWN >> %cd%\%subnet%.log

IF %count%==254 goto :eof

GOTO start