Patrick said:
('ipconfig /all ^| findstr /c:"IP Address"') do @set
IP_Address=%b
i l
How do you include this in a batch file (our logon script
is in .bat format). Also, we only need the first three
octet of the ip address to compare.... (XXX.XXX.XXX.na)
Thanks again for your assistance.
C:\cmd>demo\FirstThreeofIP
first_three=129.33.165
No match.
C:\cmd>rlist demo\FirstThreeofIP.cmd
=====begin C:\cmd\demo\FirstThreeofIP.cmd ====================
01. @echo off
02. setlocal
03. for /f "tokens=2* delims=:. " %%a in (
04. 'ipconfig /all ^| findstr /c:"IP Address"'
05. ) do set IP_Address=%%b
06. for /f "tokens=1-3 delims=." %%a in (
07. "%IP_Address%"
08. ) do set first_three=%%a.%%b.%%c
09. set first_three
10. if "%first_three%" equ "123.45.67" (
11. echo Match.
12. ) else (
13. echo No match.
14. )
=====end C:\cmd\demo\FirstThreeofIP.cmd ====================