Change the name of the files(with extension *.txt)

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Aacini
Expert
Posts: 1914
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: Change the name of the files(with extension *.txt)

#16 Post by Aacini » 09 May 2013 19:40

foxidrive wrote:It looks like my 24 time confuses it in my locale settings.
My file is called "a good dog.txt" and this is printed.

ren "good dog.txt" "good dog_10_05_2013_.txt"


Yes. If your DIR command doesn't show an "a.m." or "p.m." column, you must modify the FOR command with one token less:

Code: Select all

for /F "tokens=1,3*" %%a in ('dir /A-D /T%1 *.txt') do (


This problem may be fixed with additional code.

Antonio

Post Reply