This works too. (Win2K/XP) set hour=%time:~0,2% if "%hour:~0,1%"==" " set hour=0%time:~1,1% set folder=%date:~10,4%_%date:~4,2%_%date:~7,2% set subfolder=%hour%_%time:~3,2%_%time:~6,2% md c:\logs\%username%\%folder%\%subfolder% If you want the date and time as the foldername you could use this: set hour=%time:~0,2% if "%hour:~0,1%"==" " set hour=0%time:~1,1% set folder=%date:~10,4%_%date:~4,2%_%date:~7,2%_%hour%_%time:~3,2%_%time:~6,2% md c:\logs\%username%\%folder% Both are incomplete since I can't tell exactly what you are trying to do, but you should be able to figure out any additions you need. I just happened to be driving by and saw you were looking for something I was trying to do a week ago, and with the help of a friend we put this together. Hope it helps. cheers