windows - In a batch file, how would I compare a returned value to a value that I set and then return a true or false? -


i want compare first 3 sets or third set of numbers in %ip% home ip.

for /f "delims=[] tokens=2" %%a in ('ping shaws104 -n 1 ^| findstr "["') (set ip=%%a) echo %ip% set home=192.168.100.xxx 

try this:

for /f "tokens=1-3delims=." %%a in ("%ip%") set "ipn=%%a%%b%%c" /f "tokens=1-3delims=." %%a in ("%home%") set "homen=%%a%%b%%c" if "%ipn%"=="%homen%" (echo equal) else echo not equal 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -