The following takes a file, MB5L.txt and compresses it into a zip file with the date as part of the file name:
@For /F "tokens=1,2,3,4 delims=/ " %%A in ('Date /t') do @(
Set DayW=%%A
Set Day=%%B
Set Month=%%C
Set Year=%%D
Set All=%%D%%B%%C
)
"C:\Windows\CWBZIP.EXE" "c:\transfer\ziptest%All%.zip" "C:\transfer\MB5L.txt"
Today, it will take MB5L.txt and compress it to ziptest20120204.zip.
I want to take a file named MB5L201202.txt and compress it to MB5L20120202.zip where the "20120202" is a variable, thus allowing an administrator to run a batch file on Monday morning to archive files from the weekend.
Any suggestions greatly appreciated.