IP by Hostname

April 28, 2011 at 11:58:18
Specs: Windows 7
Hi,

I am trying to create batch file to get the IP of computers using "nslookup hostname" command but so far not able to find a way,
i was wondering if someone could help


See More: IP by Hostname

Report •

#1
May 1, 2011 at 17:09:59
::Lookup.bat
@ECHO OFF

FOR /F "skip=4 tokens=2 delims=:" %%A IN ('2^>NUL nslookup %1') DO (
    ECHO IP Address for %1: %%A
)

EXIT /B

Executed:

lookup.bat computername
IP Address for computername:   192.168.1.100

When your only tool is a hammer, every problem looks like a nail.


Report •
Related Solutions


Ask Question