Batch file,change filename with system date

Closed
beidog Posts 1 Registration date Sunday December 19, 2010 Status Member Last seen December 19, 2010 - Dec 19, 2010 at 01:35 PM
 Shital Mehra - Dec 24, 2010 at 07:50 AM
I wrote a bat file like this, to change a file name, test.txt to testMonthDayYearTime.txt



here is what i wrote:
ren c:\example\test.txt test%date:~4,2%%date:~7,2%%date:~10,4%%time:~0,2%%time:~3,2%%time:~6,2%%.txt"


But after running, the file name is test12182010 093012.txt, a space is between date and time. I don;t want the space. Anyone know what's wrong.

or there is simple way to do this? thanks!
Related:

1 response

Time command ignores the 0 at the start of the display.

try to use time /t command

MayB this helps.

;)
0