Windows Batch - Find Day of Week


I have the below batch script to create the 'DOW' variable.  However when I run it, it's choking on the 4th lineon the 'Command' part.  Not sure what is wrong.  Any help?  Prefer to keep this Windows Batch.  Running on Win Server 2003 R2.

REM Set the Day of Week (DOW) Variable
:: setDOW.bat
@echo off
Echo.|Command /C Date>DOW
set /p today=<DOW
set DOW=%today:~16,3%
echo DOW=%DOW%
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

elwayisgodAuthor Commented:
result is:


result should be: Thursday
Bill PrewIT / Software Engineering ConsultantCommented:
If you do the following command at a DOS prompt, what does it display?


elwayisgodAuthor Commented:
'Command' is not recognized as an internal or external command,
operable program or batch file.
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

elwayisgodAuthor Commented:
X:\Sam_LREF\EssbaseBackup\maxl>echo %Date%
Thu 08/19/2010
elwayisgodAuthor Commented:
I just want the 'Thu' not the rest of it. So my results would always be:

Bill PrewIT / Software Engineering ConsultantCommented:
In a BAT file, this is all you should need:

@echo off
for /F "tokens=1" %%A in ("%DATE%") do set DOW=%%A


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If your echo %date% gives Thu 08/19/2010

then you should be able to use:

SET DOW=%date:~0,3%
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.