Guest User

IP of a Machine via It's Host Name

a guest
Dec 1st, 2015
1,364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. ::Works when searching for a machine on the same network.
  2. ::ARP requests for addresses outside the subnet won't be sent at all.
  3.  
  4. @echo off
  5. set /p pc="Computer Name: "
  6.  
  7. ::Query's the PC name with it's mac address, then uses that mac address to find the IP associated with it
  8. for /f "tokens=2 delims==" %%i in ('nbtstat -a "%pc%" ^| find "MAC A"') do (for /f %%G in ('arp -a ^| find /i "%%i"') do echo %%G)
  9.  
  10. pause>nul
Advertisement
Add Comment
Please, Sign In to add comment