@ECHO OFF
REM parse date
@FOR /F "usebackq tokens=1,2,3 delims=- " %%i in (`date /T`) do (SET MM=%%j & SET DD=%%k & SET YY=%%i)
REM parse time
@FOR /F "usebackq tokens=1,2 delims=: " %%x in (`time /T`) do (SET II=%%y & SET HH=%%x)
ECHO YEAR=%YY%
ECHO MONTH=%MM%
ECHO DAY=%DD%
ECHO HOUR=%HH%
ECHO MINUTES=%II%
or shorter
@ECHO OFF
SET YY=%DATE:~0,4%
SET MM=%DATE:~5,2%
SET DD=%DATE:~8,2%
SET HH=%TIME:~0,2%
SET II=%TIME:~3,2%
SET SS=%TIME:~6,2%
ECHO YEAR=%YY%
ECHO MONTH=%MM%
ECHO DAY=%DD%
ECHO HOUR=%HH%
ECHO MINUTES=%II%
ECHO SECONDS=%SS%