Batch-file how to use variable name in a variable without Setlocal
<p>I have a big problem when i use the batch command:</p>

<pre><code>setlocal enabledelayedexpansion
</code></pre>

<p>because it dosen't keep the variables that i set in it when i use:</p>

<pre><code>endlocal enabledelayedexpansion
</code></pre>

<p>Here is my code:</p>

<pre><code>:out
setlocal enabledelayedexpansion
if "%1"=="[" goto end
if "%1"=="]" goto end
set command=%~1
if not exist !cmd%command%! (
    setlocal disabledelayedexpansion
    set /a sError=%sError%+1
    echo At line %line%: {Library Error} Unknown command: "%~1"
    set lasterror=At line %line%: {Library Error} Unknown command: "%~1".
    goto end
)
call !cmd%command%! !ext%command%! %2 %3 %4 %5 %6 %7 %8 %9
endlocal disabledelayedexpansion
if exist rewrite.tmp (
    for /f %%A in (rewrite.tmp) do set %%A
    del rewrite.tmp
)
:end
</code></pre>

<p>Edit: i changed the code because i managed to fix the problem with that part.
Here it is the solution for the previous code i posted:</p>

<pre><code>:compare
set ifcorrect=false
set var1=%~2
set comp=%~3
set var2=%~4
set iftrue=%~5
set else=%~6
set ifelse=%~7
call set var11=%%%var1%%%
call set var22=%%%var2%%%
if "%comp%"=="EQU" goto docomp
if "%comp%"=="NEQ" goto docomp
if "%comp%"=="LSS" goto docomp
if "%comp%"=="LEQ" goto docomp
if "%comp%"=="GTR" goto docomp
if "%comp%"=="GEQ" goto docomp
set /a sError=%sError%+1
set lasterror=At line %line%: {Command Error} Incorrect use of IF command.
echo At line %line%: {Command Error} Incorrect use of IF command.
goto end

:docomp
if "%var11%" %comp% "%var22%" set ifcorrect=true
if "%ifcorrect%"=="true" (
    call :execute execute "%iftrue%"
)
if "%ifcorrect%"=="false" (
    if "%else%"=="else" (
        call :execute execute "%ifelse%"
    )
)
goto end
</code></pre>