Thursday, July 14, 2011

MS DOS get timestamp in yymmdd format

:: get date pattern in yymmdd format
:: example set mydate=%date:~4,2%%date:~7,2%%date:~12,2%
:: by default %date% ---> mm/dd/yy

set yy=%date:~12,2%
set mm=%date:~4,2%
set dd=%date:~7,2%
set hr=%time:~0,2%
set mi=%time:~3,2%

SET tday=%yy%%mm%%dd%_%hr%%mi%
SET logfile=%tday: =%

No comments:

Related Posts Plugin for WordPress, Blogger...