Windows Tip Sheet
Name That IP!
Perform batch name-to-IP conversions and vice versa with these command-line tools.
This tip is part 1 in a series of 4 on cool command-line freeware.
Who says command-line scripting is dead? Certainly not the folks at Microsoft
(well, at least not the ones who helped write the 60+ new command-line tools
in Win2003), and certainly not the folks at JSI
FAQ, who posted a tip about two command-line tools that make name-to-IP
and IP-to-name conversion easier.
The tools are Ipa.exe and Ipn.exe. You can get a computer’s IP addresses
like this in a batch file:
for /f "Tokens=*" %%a in ('ipa SomeComputerName') do set IP=%%a
And you can convert an IP address to a name like this:
for /f "Tokens=*" %%a in ('ipn SomeIPAaddress') do set name=%%a
Certainly useful in a number of batch scripts I’ve seen. Enjoy!
More Resources
About the Author
Don Jones is a multiple-year recipient of Microsoft’s MVP Award, and is Curriculum Director for IT Pro Content for video training company Pluralsight. Don is also a co-founder and President of PowerShell.org, a community dedicated to Microsoft’s Windows PowerShell technology. Don has more than two decades of experience in the IT industry, and specializes in the Microsoft business technology platform. He’s the author of more than 50 technology books, an accomplished IT journalist, and a sought-after speaker and instructor at conferences worldwide. Reach Don on Twitter at @concentratedDon, or on Facebook at Facebook.com/ConcentratedDon.