I am trying to get the external IP address of a network to see if it is on the same network as other PCs, but my script isn't working. My main problem is that: No matter what I do I can't seem to get the line with the external ip address from
nslookup myip.opendns.com resolver1.opendns.com Here is what I have:
nslookup myip.opendns.com resolver1.opendns.com>IP set nu1m=0 Setlocal EnableDelayedExpansion for /F "tokens=*" %%A in (IP) do (set /a nu1m+=1 & if !num!==6 set ip=%%A) echo %ip% >Out.txt EndLocal
I've tried replacing
!ip! but no matter what I do the ip variable is empty. Any idea what I'm doing wrong?