I know that there can be many IP's assigned to a host, but I'd be glad to get even one of them to a variable (not just 127.0.0.1).
-Matti
Posted 12 November 2001 - 12:36
I know that there can be many IP's assigned to a host, but I'd be glad to get even one of them to a variable (not just 127.0.0.1).
-Matti
Posted 18 November 2001 - 11:31
@echo off
set FILE=%1
if {%1}=={} set FILE=NOFILE
for /f "delims=[] tokens=2" %%i in ('ping -n 1 %COMPUTERNAME% ^| findstr /I "%COMPUTERNAME%"') do set IP=%%i
echo %IP%
if not %FILE%==NOFILE echo %IP% > %FILE%
Then I called this script from InstallScript and directed the output to a file. I opened the file and I got the IP I wanted. Works quite well on multihomed hosts too.
-MM