Код:
@Echo Off
cls
FOR /F "tokens=2 delims==." %%d in ('WMIC OS GET LOCALDATETIME /VALUE') DO SET "sDateTime=%%d"
set "sYear=%sDateTime:~0,4%"
set "sMonth=%sDateTime:~4,2%"
set "sDay=%sDateTime:~6,2%"
set "sHour=%sDateTime:~8,2%"
set "sMinute=%sDateTime:~10,2%"
set "sSecond=%sDateTime:~12,2%"
echo Year: %sYear%
echo Month: %sMonth%
echo Day: %sDay%
echo Hour: %sHour%
echo Minute: %sMinute%
echo Second: %sSecond%
exit /b 0