Software >> OS >> Windows >> Command Line >> How to assign a current day of the week to an environment variable



## In batch file, use double percent %% prefix for the loop variable

@for /f "tokens=1-2 delims= " %%a in ('Date /T') do set SomeVar=%%a
echo "%SomeVar%"


## on command prompt, use single percent % prefix for the loop variable

@for /f "tokens=1-2 delims= " %a in ('Date /T') do set SomeVar=%a
echo "%SomeVar%"