Problem identifying 1st Sunday of a month

Joined
May 7, 2022
Messages
1
Reaction score
0
Appears to work for all instances EXCEPT the 1st Sunday of a mont
-----------------------------------
@echo off
set mydow="Sunday"
set myday=5
if not "%mydow%"=="Sunday" goto NotRightDay
if %myday% <= 7 goto FirstSunRoutine
goto over

:FirstSunRoutine
echo This is the 1st Sunday Routine
goto over

:NotRightDay
echo This is not the 1st Sunday of the month
goto over

:eek:ver
echo done
 
Joined
Mar 28, 2022
Messages
82
Reaction score
11
In the first if statement, the variable %mydow% shouldn't be enclosed with quotes.
Also, here's a list of batch file programming operators
Code:
set mydow="Sunday"
set myday=5

if %mydow% NEQ "Sunday" goto NotRightDay
:: else it's a Sunday

if %myday% LEQ 7 goto FirstSunRoutine
:: else it's not the first week
goto over
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,920
Messages
2,570,038
Members
46,449
Latest member
onedumbsquirrel

Latest Threads

Top