Solved script for renaming a file with date

April 27, 2013 at 21:03:51
Specs: Windows XP
can u please explain why the below script is used

ren test.txt test%date:~4,2%-%date:~7,2%-%date:~10%.txt

like ren is to rename test.txt to
after that i was not able 2 understand so can u kindly explain y %date is used
and y :~4,2 etc everything could you please explain me FishMonger

See More: script for renaming a file with date

Report •

April 28, 2013 at 08:05:41
set /?

and read the built-in help

M2 Golden-Triangle

Report •

April 28, 2013 at 15:35:07
✔ Best Answer
Or, just play with it on commandline and observe, type:
echo %date%
echo %date:~4,2%
echo %date:~-4%
echo %date:~0,3%

Then it will probably explain itself (hint: base zero, not one, for start position).

Report •

May 2, 2013 at 08:21:07
This one is another reference, I use it when my memory faults.

The rest of the page is also worthwhile

:: mike

Report •

Related Solutions

Ask Question