You can add conditions to your batch file. For example see the below sample.
@echo off
echo "starting the program"
set expiry=20221002
set mydate=%date:~10,4%%date:~4,2%%date:~7,2%
if %mydate% LEQ %expiry% (echo "execute the script") Else (echo "Date Expired")
Basically it sets an expiry date to a number with yyyymmdd format. then from the current date, set another variable with yyyymmdd format. Then do a simble Less than or Equal comparison and if yes execute the script.
You may need to see your date format by entering the dos command Date /T in the command prompt and adjust the statement to extract the date from the current date.
If you have may statements to execute in if statements, try to use goto. Refer: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/goto
Find the sample output for the script where I set the expriy as Second October
see the execution of else part when I set date as 1st October
If you wish to learn batch script in detail, refer: https://www.tutorialspoint.com/batch_script/index.htm
Hope this helps