for /F \"tokens=1-4 delims=/ \" %%i in (\'date /t\') do (
set Day=%%k
set Month=%%j
set Year=%%l
set DATE=%%k/%%j/%%l)
I am try to get the date int
I have derived the shortest from the already given solutions. This works on every system (XP Pro and up):
REM ===================================================================
REM CREATE UNIQUE DATETIME STRING IN FORMAT YYYYMMDD-HHMMSS
REM ======================================================================
FOR /f %%a IN ('WMIC OS GET LocalDateTime ^| FIND "."') DO SET DTS=%%a
SET DateTime=%DTS:~0,8%-%DTS:~8,6%
REM ======================================================================
Of course you can play with the resulting string format.