The are a number of ways to return today's date to a script:

<a href="/article/jsifaq/jsi-tip-8600-today-bat-returns-today-s-numeric-month-day-and-year-the-3-character-month-abbreviation-and-the-2-digit-month-and-day-.aspx"><b>Today.bat</b></a>    - Good for both calculations and setting file names.
<a href="/article/jsifaq/jsi-tip-4835-the-universal-date-parser-modified-to-also-work-with-windows-xp-.aspx"><b>UnivDate.bat</b></a> - Use with <a href="/article/jsifaq/jsi-tip-8181-how-can-i-insure-that-a-year-month-and-day-contain-4-2-and-2-digits-respectively-.aspx"><b>YYYYMMDD.bat</b></a> to set file names.
NOTE: For calculations, use:
<a href="/article/jsifaq/jsi-tip-8293-how-can-i-return-the-date-that-is-plus-or-minus-n-days-from-today-.aspx"><b>JSIDateM.bat</b> - General purpose date math routine.</a>
<a href="/article/jsifaq/jsi-tip-8293-how-can-i-return-the-date-that-is-plus-or-minus-n-days-from-today-.aspx"><b>DatePorM.bat</b> - How can I return the date that is plus or minus n days from today?</a>
I have scripted TDYMD.bat to return today's 4 digit year, 2 digit month, and 2 digit day, regardless of your date format.

TDYMD.bat is optimized for setting file names.

The syntax for using TDYMD.bat is:

call TDYMD YYYY MM DD

Where:

<b>YYYY</b>  is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain today's 4 digit year.
<b>MM</b>    is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain today's 2 digit month.
<b>DD</b>    is a <a href="/article/jsifaq/jsi-tip-5535-how-can-i-cause-a-called-batch-file-to-return-a-call-directed-environment-variable-.aspx">call directed environment variable</a> that will contain today's 2 digit day.
TDYMD.bat contains:
@echo off
if \{%3\}==\{\} @echo Syntax :TDYMD YYYY MM DD&goto :EOF
<font size="1">if not exist "%TEMP%\TDYMD.VBS" @echo Wscript.Echo Year(Now()) ^& " " ^& Right("0" ^& Month(Now()),2) ^& " " ^& Right("0" ^& Day(Now()),2)>"%TEMP%\TDYMD.VBS"</font>
for /f "tokens=1-3" %%x in ('cscript.exe //Nologo "%TEMP%\TDYMD.VBS"') do (
 set %1=%%x
 set %2=%%y
 set %3=%%z
)