Post Content

Get current Date/Time[-][--][++]

@echo off

FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B
FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B
FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B
FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B
FOR /F "TOKENS=1-5 DELIMS=:" %%d in ("%time%") DO SET h=%%d
FOR /F "TOKENS=1-5 DELIMS=:" %%d in ("%time%") DO SET m=%%e
FOR /F "TOKENS=1-5 DELIMS=:" %%d in ("%time%") DO SET s=%%f

SET dateFilename=%yyyy%-%mm%-%dd%_%h%.%m%.%s%

REM this will pring 2008-01-28_15.48.32.45
echo %dateFileName%    

Notice the %s% print seconds and milliseconds (43.32)