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
 
Ad

Advertisements

Joined
Mar 28, 2022
Messages
75
Reaction score
8
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

Top