hello i got a batch file, something like this:
if %day%==monday, tuesday, wednesday, thursday, friday (
goto yes
) else (
goto no
)
Now i know
As Jay has mentioned, using date /t
will only work on locales where this command outputs the day of week along with the date, and won't work on other locales (e.g. Russian). If you don't mind mixing your batch files with some VBScript, here's a solution that should work on all locales.
The trick is this tiny VBScript script that outputs the day of the week as a number (1 = Sunday, 2 = Monday, ... 7 = Saturday):
WScript.Echo DatePart("w", Date)
You can run this script from your batch file, read its output and apply your logic:
for /f %%d in ('cscript dayofweek.vbs //nologo') do (
if %%d==7 goto no :: Saturday
if %%d==1 goto no :: Sunday
)
goto yes