@echo off
cls
echo This program calculates the years (within a specified range) that a
echo certain day of a certain month fell on a certain day of the week.
echo.
echo Please enter the day of the week that you want to search for.
echo 1 = Sunday
echo 2 = Monday
echo 3 = Tuesday
echo 4 = Wednesday
echo 5 = Thursday
echo 6 = Friday
echo 7 = Saturday
echo.
Fdate /FgetK /K1234567x /Q"Please press a number, or ESC to exit > " /vdow
if (%Dow%)==(x) goto endit
if (%Dow%)==(1) set DowName=Sunday
if (%Dow%)==(2) set DowName=Monday
if (%Dow%)==(3) set DowName=Tuesday
if (%Dow%)==(4) set DowName=Wednesday
if (%Dow%)==(5) set DowName=Thursday
if (%Dow%)==(6) set DowName=Friday
if (%Dow%)==(7) set DowName=Saturday
echo You chose day of the week: %dowName%
pause
Fdate /fget /Q"Please enter first year in year range > " /vBegYr
Fdate /fget /Q"Please enter last_ year in year range > " /vEndYr
Fdate /fget /Q"Please enter month number (1-12) > " /vMonNum
Fdate /fget /Q"Please enter day__ number (1-31) > " /vDayNum
set Yr=%BegYr%
Fdate /Fsubstr /a-2 /q00%MonNum% /vMonNum
REM >whatday.txt
cls
echo Looking for %MonNum%/%DayNum% on %DowName%
echo between %BegYr% and %EndYr%
echo ----------------------------------------------
echo Looking for %MonNum%/%DayNum% on %DowName% >>whatday.txt
echo between %BegYr% and %EndYr% >>whatday.txt
echo ---------------------------------------------- >>whatday.txt
:LoopTop
Fdate /Fsubstr /a-4 /q0000%yr% /vyr
echo Testing %yr%
Fdate /Ff /Idd-mm-ccyy /A%DayNum%-%MonNum%-%Yr% /v
Fdate /Ff /Idd-mm-ccyy /A%DayNum%-%MonNum%-%Yr% /odow# /vdow#
Fdate /Ff /Idd-mm-ccyy /A%DayNum%-%MonNum%-%Yr% /omm /vmm
if (%Dow#%)==(%Dow%) if (%MonNum%)==(%mm%) echo %fdate%
if (%Dow#%)==(%Dow%) if (%MonNum%)==(%mm%) echo %fdate% >>Whatday.txt
Fdate /f#add /A%yr% /B1 /vYr
Fdate /F#comp /A%yr% /B%EndYr% /v
if (%fdate%)==(GT) goto LoopEnd
goto LoopTop
:LoopEnd
cls
type whatday.txt
echo.
echo This data has been written to file: Whatday.txt
echo.
:endit
set Yr=
set BegYr=
set EndYr=
set mm=
set Dow=
set Dow#=
set DowName=
set Fdate=
set MonNum=
set DayNum=