I want to create a folder that uses TIME
formatted in a specific way. I want the format to be in hh.mm.ss since you can't use a :
in a folder name.
When I use set CurTime=%time:~0,2%.%time:~3,2%.%time:~6,2%
, I get an output with a leading space before 10:00 AM and five trailing spaces as well (not sure why). I can remove the spaces by adding the line set CurTime=%CurTime: =%
, but I want to add a leading zero if the time is earlier than 10:00 AM.
How can I do this?
Edit for clarification: I have the time formatted the way I want it, but I want to replace the leading space with a 0 if the hh portion is less than 10. This is not a duplicate question of How to get current datetime on Windows command line, in a suitable format for using in a filename?.