clipped from: thetechnotebook.wordpress.com   

I had an issue today where I needed to find all of the machine names on the local network along with their IP addresses.


Here is a batch file that helps do just that:


@echo off
echo > c:\network.txt IP Address NetBIOS Name
echo > c:\network.txt ============================
for /F %%a in (’net view ^ find “\\”‘) do call :Sub %%a
goto :eof

:Sub
set name=%1
set name=%name:~2%
for /F “tokens=3 delims=: ” %%a in (’ping %name% -n 1 ^ find /i “bytes=”‘) do set IP=%%a
echo >> c:\network.txt %name% %ip%