Sign in with
Sign up | Sign in
Your question

Batch file, change filename with system date and time infor

Last response: in Applications
Share
December 19, 2010 6:37:14 AM

I wrote a bat file like this, to changea 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.
a b L Programming
December 19, 2010 1:56:46 PM

What is your system's date and time format? Just do "echo '%date%'" and "echo '%time%'".
m
0
l
!