Windows bat script to get day of the week

rem Script to get the day of the week in windows command line

rem ie Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday

@echo off
SETLOCAL
SET /a count=0
FOR /F “skip=1” %%D IN (‘wmic path win32_localtime get dayofweek’) DO (
set To=%%D
IF %%D==0 set Today=Sunday
IF %%D==1 set Today=Monday
IF %%D==2 set Today=Tuesday
IF %%D==3 set Today=Wednesday
IF %%D==4 set Today=Thursday
IF %%D==5 set Today=Friday
IF %%D==6 set Today=Saturday
SET /a count+=1
goto next
)
:next
echo %Today%

This entry was posted in Batch script, Windows. Bookmark the permalink.

Leave a Reply