More Date Variable / Batch File Difficulties
Posted on 2004-08-03
Hi all, I seem to have a probalem that's got a few other vistors scracthing their heads.
After reading some online docs and posts I've worked out how to get the relevant info as a variable, this being the first three characters of the date.
DATE/T > C:\Temp\Date.txt (e.g. output - Mon 02/08/2004)
For /F "tokens=1 delims= " %%A IN (C:\Temp\Date.txt) DO IF "%%A" == "Mon" COPY C:\OriginalDirectory\Mon-file.001.Z C:\Temp
That works and copies the right file, so I copied that line so I now have a FOR line for each day of the week and that seems to be fine to.
I put that together from bits that I found online and I understand the tokens and delims part but not the %%A variable, could someone explain that and where to find out what all the other variables are?
Hopefully armed with a list of variables I'll understand it more. Until then, this is the problem
After the above has copied the relevant file, (which always starts like Mon, Tue, Wed etc) I need to rename the file from Mon-file.001.Z to ddmm.Z and then after that unzip the file and again rename it (I don't know an easier way)
I was hoping this would work for the naming part then adapted for the unzip, but not
FOR /F "tokens=2,3 delims=/" %%A IN (c:\temp\Date.txt) DO IF "%%A" == "0208" rename "%TEMP%\Mon*.*.Z" %%A.Z
Could someone explain how to get the ddmm from the same date.txt file to use with the rename and unzip?