I am trying to do a FOR /L loop for a class of mine i have gotten it to loop the 12 times but its not changing the MonthName variable to display each month. what i want it ot so is take the current month number and execute the loop that many times with the months of the year like for the first time through the loop i want it to display 1. January then 2. Febuary and so on till it reaches the current month here is the code i have so far and a sample execution i can only get it to display the current month's name
rem @echo off
setlocal enabledelayedexpansion
set CurrentMonth=%date:~4,2%
IF %currentMonth% EQU 08 (
set /a currentMonth=8
)
IF %currentMonth% EQU 09 (
set /a currentMonth=9
)
set Mmap=1-Januray;2-Febuary;3-March;4-April;5-May;6-June;7-July;8-August;9-September;10-October;11-November;12-December;
FOR /L %%x in (1,1,!CurrentMonth!) DO (
call set MonthName=%%Mmap:*%%x-=%%
set MonthName=%MonthName:;=&rem.%
echo %%x !MonthName! )
C:\Users\cis106stu\BATCHFILES5>FORLOOP
1 December
2 December
3 December
4 December
5 December
6 December
7 December
8 December
9 December
10 December
11 December
12 December
C:\Users\cis106stu\BATCHFILES5>