Excuse me. I don't like this type of code. In my personal opinion, it is much clear to manage these values as an array this way:
rem Prepare the array of two-digits values for each 3-letters month names:
for %%a in ("Jan=01" "Feb=02" "Mar=03" "Apr=04" "May=05" "Jun=06" "Jul=07" "Aug=08" "Sep=09" "Oct=10" "Nov=11" "Dec=12") do (
set month%%~a
)
rem Previous code is equivalent to these 12 lines:
rem set monthJan=01
rem set monthFeb=02
. . . .
rem set monthDec=12
rem This way, the result is immediately accessible:
SET v=May
CALL SET v=%%month%v%%%
rem Or in the clearer way using Delayed Expansion:
SET v=!month%v%!
monthXXX
is an array of values for 12 different 3-letters month names.
SET v=May
set the value of the index to an element array.
SET v=!month%v%!
is first expanded to SET v=!monthMay!
(normal expansion), and then to SET v=05
(Delayed Expansion).
I had explained the reasons I have to prefer this notation with every detail in these posts:
Arrays, linked lists and other data structures in cmd.exe (batch) script
DIR output into BAT array?
I apologize if someone thinks this answer is off-topic...
Antonio