Script Time Question Leading 0

Hello,

SET t1=%TIME:~0,2%
SET t2=%TIME:~3,2%
SET t3=%TIME:~6,4%
SET g1=%DATE:~4,2%
SET g2=%DATE:~7,2%
SET g3=%DATE:~10,4%


I use the above to get the time into chunks.

and them in a file.

move  myFile.txt    myFile-%g1%_%g2%_%g3%-%t1%_%t2%_%t3%.txt

It works fine as long as there is a 2 digit hour such as 10 11 or 12

If it is 7AM  how can I get the hour above to have a leading 0?   such as 07  instead of just 7

T1 above is what holds the hour.


Thanks!

Randy
LVL 6
rjohnsonjrAsked:
Who is Participating?
 
vsg375Connect With a Mentor Commented:
Hi

If I guess well, it seems that you want to add date and time to your filename. I've tried to deal with that problem and finally gave up, because there is an excellent piece of software doing that for you :

http://www.informatics-consulting.de/software/namedate.htm

HTH
Cheers
0
 
rjohnsonjrAuthor Commented:
Thanks man,  This is an awesome utility
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.