Batch file to create folder name with time stamp

By | March 24, 2010

REM Create sub directory called \yymmdd_hhmmss


REM where yymmdd_hhmmss is a date_time stamp like 030902_134200


set hh=%time:~0,2%


REM Since there is no leading zero for times before 10 am, have to put in


REM a zero when this is run before 10 am.


if “%time:~0,1%”==” ” set hh=0%hh:~1,1%


set yymmdd_hhmmss=%date:~12,2%%date:~4,2%%date:~7,2%_%hh%%time:~3,2%%time:~6,2%


md h:\%yymmdd_hhmmss%