REM http://groups.google.com/group/alt.msdos.batch.nt/msg/923423bf3143fcdd
REM http://www.dostips.com/DtTipsStringManipulation.php
REM change format from 14/02/2009 to 2009-02-14
echo off
SET thedate=%date%
REM only take the last 4
REM start at number 3, take 2
REM start at 0, take 2
SET theyear=%thedate:~-4%
SET themonth=%thedate:~3,2%
SET theday=%thedate:~0,2%
echo %thedate%
echo %theyear%
echo %themonth%
echo %theday%
SET hyphen=-
SET filedate=%theyear%%hyphen%%themonth%%hyphen%%theday%
echo %filedate%
REM [%~letter] One sided variables only
REM %~I removes any surrounding quotes (")
REM %~fI Fully qualified path name
REM %~dI Drive letter only
REM %~pI Path only
REM %~nI file Name only
REM %~xI eXtension only
REM %~sI Short names only
REM %~aI Attributes #
REM %~tI Time and date of file #
REM %~zI siZe of file #