How to find the IP address of the local computer in a logon script or other batch

Posted Sunday, 20 May 2007 by Misha Hanin
Digg!

Using only built-in functionality, use the following line to set the IP environment variable:

for /f "skip=1 Tokens=2 Delims=[]" %%i in ('ping -n 1 %computername%') do set ip=%%i

or

for /f "tokens=2 delims=: " %%a in ('nslookup %computername%') do set ip=%%a  





Reddit!Del.icio.us!Google!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Ma.gnolia!Free social bookmarking plugins and extensions for Joomla! websites! title=
 

Add comment

You have no rights to add a new comment. May be you need to register on the site.