@ECHO off&setlocal enabledelayedexpansion ECHO.&ECHO. 正在获取本机的IP地址,请稍等... for /f tokens=3 skip=2 delims=: %%i in ('nbtstat -n') do ( cls set IP=%%i set IP=!IP:~1,-1!
goto :next ) :next ECHO.&ECHO. ECHO 本机IP为:!IP! for /f delims=. tokens=1,2,3,4 %%i in (!IP!) do set ipall=%%i.%%j.%%k ECHO.&ECHO. 正在获取【%ipall%.*】段内的其它在线计算机名,请稍等... ECHO.&ECHO.本网段内的在线计算机有:
for /f delims= %%i in ('net view') do ( set var=%%i if !var:~0,2!==\\ ( set var=!var:~2! for /f tokens=3 delims=: %%a in ('ping !var! -n 1^|findstr /i /r Reply') do ( echo. echo 计算机{!var!}的ip地址为 [%%a]