duguo.org »  last updated 13:18, 21 September 2007 by Du, Guo

Windows batch rename file with timestamp

From duguo.org

Jump to: navigation, search

Following scritp will rename C:\temp\original.txt to C:\temp\new-20070821-112059.text

for /f "tokens=1-6 delims=/:. " %%a in (
"%date%:%time%") do rename C:\temp\original.txt C:\temp\new-%%c%%b%%a-%%d%%e%%f.txt