I have a line in a batch file that renames a file with a date and time appended to it.
rename "C:\Program Files (x86)\File Directory\sub directory\logs\Backups\Client.txt" Client%date:~7,2%%date:~4,2%%date:~10,4%%time:~0,2%%time:~3,2%%time:~6,2%.txt
This works fine, except if the first time parameter (%time:~0,2%) is a single digit. It will error with an incorrect syntax command. I understand why it occurs (there's a similar post here) but can't seem to get the correct syntax to make the command run successfully when the hour parameter is a single digit (between 01-09).
What command syntax do I need to add to make sure the command works with single digits for the hour ?