Batch Programme: parse Day of Week

Soldato
Joined
9 Nov 2003
Posts
9,515
Location
The Motor City
I'm trying to batchify *sic* a CMD line to parse the Day of Week from the DATE variable. From a command line it works perfectly. But from a batch file it causes an 'unexpected' result. Is there something I need to define first to get it to operate properly?

Code:
for /f "tokens=1" %1 in ('date /t') do set DOW=%1
The command 'ECHO %DOW%' gives the desired result, so I know the variable is set properly.

But from a batch file, it returns:
Code:
in was unexpected at this time.

C:\>for /f "tokens=1"  in ('date /t') do set DOW=
It looks like it's ignoring the %1 I'm trying to set. Any ideas what's going wrong? I've tried it with various other variable other than %1 as well.
 
Back
Top Bottom