I have this:
@echo off
setlocal ENABLEDELAYEDEXPANSION
set bla="-666"
set zzz="333"
if !zzz! LSS !bla! echo lesser
pause
Gives me “lesser” which is wrong. I know this is because of the ASCII values. But what is the way around to compare them as if they are numbers?
EDIT:
Some more codes:
set mn=99999
for /f "tokens=1-9" %%a in (%%g) do (
set zzz=%%d
)
if "!zzz!" LSS "!mn!" set mn=!zzz!
None of the answers below gave me the correct result so far…
This works for me, removing the quotes and then comparing.