Auto update date in file name with batch script

June 2, 2015 at 10:58:11
Specs: Windows 7
Hello all,
I am trying to write a batch script that will auto update the date portion of files I receive on a regular basis. For example the file names will look like: test file(20150101).
The numbers in parenthesis is the date in the format I need it in. So far I have:

FOR /F "tokens=2 delims=()" %%a IN ("test file(20150101)") DO (set var=%%a)
set "_year=%var:~0,4%"
set "_month=%var:~4,2%"
set "_day=%var:~6,2%"

This does not seem to be updating the date in the file name. Is there a way to get the desired results in the format I want?
Thanks


See More: Auto update date in file name with batch script

Report •

#1
June 2, 2015 at 23:43:03
So you set 3 vars to YYYY MM DD.

Now what?

=====================

M2 Get custom script or take private lessons


Report •
Related Solutions


Ask Question