Comparing variables inside a /F loop (BATCH) <p>I have this code:</p> <pre><code>@echo off SETLOCAL ENABLEDELAYEDEXPANSION SET /A counter=0 SET /A counter2=0 for /f %%h in (users.txt) do ( set /a counter2=0 set /a counter=!counter!+1 for /f %%i in (users.txt) do ( set /a counter2=!counter2!+1 IF !counter! gtr !counter2! echo !counter! and !counter2! ) ) </code></pre> <p>For some reason I the If statement in there errors. If I cross it out it all runs just fine. What's wrong with my syntax? Thanks!</p>