How to rename a file with current datetime?

February 13, 2011 at 11:24:57
Specs: Windows 7
Hi,

when i try this code:
for /F "tokens=1-4 delims=/ " %%A in ('echo %date%') do rename File.txt %%B%%C%%D.txt

It renames File.txt to 022011 without extension .txt and there is no time and day.
there is only month and year.

why please?
thank you


See More: How to rename a file with current datetime?

Report •


#1
February 13, 2011 at 11:56:37
thank you, the solution is:

set mydate=%date:~6,4%%date:~3,2%%date:~0,2%
move toto.txt toto-%mydate%.txt

it works i don't have time
thx


Report •
Related Solutions


Ask Question