I first scripted Day.bat to convert a date to the day number and day name.

Using the VBScript weekday function, I have scripted DayWeek.bat to convert a date to the day number and day name.

The syntax for using DayWeek.bat is:

\[call\] DayWeek Dt DayNumb DayText

Where:

<b>Dt</b>      is a date, using your shortdate format, like 09/28/2006.

<b>DayNumb</b> is a <a href="/article/tips/tip.aspx?id=5535">call directed numeric environment variable</a> that will contain the day number,
        per the following: 0 Unknown
                           1 Sunday
                           2 Monday
                           3 Tuesday
                           4 Wednesday
                           5 Thursday
                           6 Friday
                           7 Saturday

<b>DayText</b> is a <a href="/article/tips/tip.aspx?id=5535">call directed environment variable</a> that will contain the day text.
DayWeek.bat contains:
@echo off
if \{%3\}==\{\} @echo Syntax: DayWeek Dt DayNumb DayText&goto :EOF
setlocal
if exist "%TEMP%\DayWeek.vbs" goto :doit
@echo.Dim Arguments >"%TEMP%\DayWeek.vbs"
@echo.Set Arguments = Wscript.Arguments >>"%TEMP%\DayWeek.vbs"
@echo.wScript.Echo weekday(Arguments(0)) >>"%TEMP%\DayWeek.vbs"
:doit
set /a DayNumb=0
for /f "Tokens=1" %%a in ('cscript //nologo "%TEMP%\DayWeek.vbs" %1') do (
 set /a DayNumb=%%a
)
If %DayNumb% EQU 0 set DayText=Unknown&goto :finish
set daytab=Sunday###Monday###Tuesday##WednesdayThursday#Friday###Saturday#
set /a Day=%DayNumb% -1
set /a Day=%Day% * 9
call set DayText=%%daytab:~%day%^,9%%
set DayText=%DayText:#=%
:finish
endlocal&set /a %2=%DayNumb%&set %3=%DayText%