I have the following code:
echo off
set n=11
set m=12
set /a nme=3
set /a mdiff=nme-1
pause
if %n% NEQ %m% (
if %mdiff% LEQ 3 (
for /l %%C in (1,1,3) do (
if %%C EQU 1 (
set mon=Apr
)
set num=1%mon%
)
)
)
echo %num%
pause
which gives me output 1 instead of 1Apr. However when I place set num=1%mon% outside all if and for loops it gives correct result.
Please explain me what happened here and how to obtain the correct result inside the loops.
Also, what is the maximum depth of if and for levels?
mon=Aprand not concatenate with 1. – avirk May 21 '12 at 02:47