Solved How to rename a files with current date.

July 1, 2012 at 00:09:35
Specs: Windows 7
how do i rename the file using batch.

How to rename a files with current date.for example my file name is hope.txt after i run batch it should be like hope.dd.mm.yyyy.txt


See More: How to rename a files with current date.

Report •

#1
July 1, 2012 at 17:57:17
✔ Best Answer
this might do it for one file (full-name supplied on commandline), depending, as always, on your date format.

@echo off & setlocal
for /f "tokens=2-4 delims=-/ " do set dname=%%b.%%a.%%c
set base=%~n1%
set ext=%~x1%
ren %1 %1.%dname%%ext

if you want the file's date to be the name, that's another matter, but do-able.


Report •
Related Solutions


Ask Question