O que você precisa fazer é colocar um SetLocal EnableDelayedExpansion no topo do seu script e usar ! s em torno de suas variáveis.
Delayed Expansion will cause variables to be expanded at execution time rather than at parse time, this option is turned on with the
SETLOCALcommand. When delayed expansion is in effect variables may be referenced using!variable_name!(in addition to the normal%variable_name%)Delayed variable expansion is often useful when working with
FORLoops, normally an entireFORloop is evaluated as a single command even if it spans multiple lines of a batch script.
Basicamente, o loop for é analisado uma vez. Cada iteração do loop, as instruções são executadas. Ao ativar essa opção, as variáveis podem mudar na execução, sem reparos, ou seja, dentro do loop.
@echo off
SetLocal EnableDelayedExpansion
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