Question : MS DOS command to output ONLY IP address

Hi, I'm writing a script and I need a command to output the computer's current IP address.

Something like:
echo %ipaddress%
(but that doesn't work)

ipconfig /all outputs too much info .. I just want the IP address.

Please help,
Thanks,
Jamie

Answer : MS DOS command to output ONLY IP address

This command (in a batch file ONLY) should do the trick:
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| find /i "IP Address"') do @Echo %%a
If you want to put it in an environment variable, then:
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| find /i "IP Address"') do @set IPAddress=%%a

Run outside of a batch file, you'd need to remove change all %%a to %a
Random Solutions  
 
programming4us programming4us