troubleshooting Question

Windows Batch/Dos - Ignore Case

Avatar of elwayisgod
elwayisgodFlag for United States of America asked on
Microsoft DOSWindows 2000Windows Batch
8 Comments1 Solution2847 ViewsLast Modified:
I set a variable %dow%  and it sets it in this case Mon, Tue, Wed, Thu, Fri, Sat, Sun.  However just in case it ever sets it as MON, for example I need the following batch to handle it correctly and not take into account the case:

REM Now determine which folder to delete in the 'Weekly' location so only last 3 days backup are retained
IF %dow% /i == Sun GOTO SUNDAY >> %ess_bkup_log_file% 2>&1
IF %dow% /i == Mon GOTO MONDAY >> %ess_bkup_log_file% 2>&1
IF %dow% /i == Tue GOTO TUESDAY >> %ess_bkup_log_file% 2>&1
IF %dow% /i == Wed GOTO WEDNESDAY >> %ess_bkup_log_file% 2>&1
IF %dow% /i == Thu GOTO THURSDAY >> %ess_bkup_log_file% 2>&1
IF %dow% /i == Fri GOTO FRIDAY >> %ess_bkup_log_file% 2>&1
IF %dow% /i == Sat GOTO SATURDAY >> %ess_bkup_log_file% 2>&1

:SUNDAY
rmdir %rmdir_weekly%\THU /s /q >> %ess_bkup_log_file% 2>&1
GOTO END

:MONDAY
rmdir %rmdir_weekly%\FRI /s /q >> %ess_bkup_log_file% 2>&1
GOTO END

:TUESDAY
rmdir %rmdir_weekly%\SAT /s /q >> %ess_bkup_log_file% 2>&1
GOTO END

:WEDNESDAY
rmdir %rmdir_weekly%\SUN /s /q >> %ess_bkup_log_file% 2>&1
GOTO END

:THURSDAY
rmdir %rmdir_weekly%\MON /s /q >> %ess_bkup_log_file% 2>&1
GOTO END

:FRIDAY
rmdir %rmdir_weekly%\TUE /s /q >> %ess_bkup_log_file% 2>&1
GOTO END

:SATURDAY
rmdir %rmdir_weekly%\WED /s /q >> %ess_bkup_log_file% 2>&1
GOTO END


:END
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros