I'm trying to make a batch script to get local IP-address of active NIC (could be wireless or local). To get IP adress I have used following line:
FOR /F "delims=[] tokens=2" %%a in ('ping -4 %computername% -n 1 ^| findstr "["') do (set thisip=%%a)
I then have the IP address. The range is depending of the second group (eg. 64 in 172.64.10.10). I would like to launch a script if the local IP address is within 64 - 127 in the second group.
How can I do that?
I already tried to export the value in the second group but then I must export two or three characters:
SET IP=%thisip:~3,2%
Then I have managed to loop through the numbers but I am thinking wrong I don´t want to run the script more then once and my loop runs several times depending of what the IP Adress is:
:MyLoop
IF "%IP%" LSS "64" GOTO EndLoop
IF "%IP%" GTR "99" GOTO EndLoop
ECHO %IP%
SET /A IP+=1
GOTO MyLoop
:EndLoop