I'm trying to write a simple .bat job that will rename a certain file from "file-20060713.txt" (created with today's date in a 3rd party software) as "file-20060630.txt" (the last day of the previous month).
I have used this script in previous .bat jobs to name files with the current date:
The resulting file name if run today would be 20060713.txt
I've tried to find commands that would set this to 063006.txt but am coming up empty.
I'd be running this on a WinXP Profession box.
Thanks for any help!
I have used this script in previous .bat jobs to name files with the current date:
Code:
@echo off
for /f "tokens=2 delims= " %%A in ('date/T') do (
set date=%%A)
for /f "tokens=1-3 delims=/" %%A in ('echo %date%') do (
set m=%%A
set d=%%B
set y=%%C)
ren "C:\My Files\file.txt" %y%%m%%d%.txt
The resulting file name if run today would be 20060713.txt
I've tried to find commands that would set this to 063006.txt but am coming up empty.
I'd be running this on a WinXP Profession box.
Thanks for any help!