Proper Logic
Posted: 17 Feb 2014 21:27
for the likes of me , I can't seem to get this "basic" logical to compare values; how can it verify correctly the If condition?
If %MyBit% does have the value 100 then %var1% should be echoed to GBitLockIP.txt but instead the value is being written to BBitLockIP.txt.
If %MyBit% does have the value less than 100 then %var1% should be echoed to BBitLockIP.txt but I instead see the value is being written to GBitLockIP.txt.
Please, what's the proper logic?
thank you for the valued support.
v/r Booga73
If %MyBit% does have the value 100 then %var1% should be echoed to GBitLockIP.txt but instead the value is being written to BBitLockIP.txt.
If %MyBit% does have the value less than 100 then %var1% should be echoed to BBitLockIP.txt but I instead see the value is being written to GBitLockIP.txt.
Please, what's the proper logic?
Code: Select all
@ECHO OFF
set var1=192.168.1.1
set /a GoodBit=100
rem c:\temp1a\tmp1.txt has a single line which is a number from 0 to 100, i.e. 100% is current value.
for /f "tokens=1 delims=%%" %%b in (c:\temp1a\tmp1.txt) do set /a MyBit=%%b
rem this echo statement shows on screen the correct value extracted from tmp1.txt.
echo MyValue: %MyBit%
If "%MyBit%" EQU "GoodBit" echo %var1% >> C:\temp1a\GBitLockIP.txt
If "%MyBit%" NEQ "GoodBit" echo %var1% >> c:\temp1a\BBitLockIP.txt
thank you for the valued support.
v/r Booga73