I have the following in a batch file.
set timefmt=%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%
dir *.* > logfile_%timefmt%.log
This works perfectly after 10am, but fails before hand because it adds a space to the timestamp instead of a leading 0.
Is there a way in MS-DOS to create a time stamp with a leading 0? I'd prefer to use fairly standard commands so that it works from Windows XP onward.