Molecule Posted June 20, 2011 Posted June 20, 2011 (edited) I've tried every combination and permutation of % and %% and A and a and ` ` and ' ' and " " and ... I can think ofI still get "syntax error"I have x number of 7z archives of my thunderbird email account, backup1.7z, backup2.7z etc, in a /BACKUP dirI want to set a variable to the oldest file name, so that the next time 7zip runs, it overwrites the oldestbatch is run from the /BACKUP dir7za.exe command line version is in c:\windowsclsDIR /B/O-D *.7zrem successfully generates a list of 7zip archives with oldest file firstFOR /F %%A IN ('DIR /B/O-D *.7z') DO SET %OLDEST%=%%Arem every permutation generates a "syntax error"!7za a %OLDEST% "c:\windows\application data\thunderbird\*"rem when %OLDEST% is set manually, 7zip generates the archivecan anyone see what I am doing wrong? help!using w98se with soporifics/mgdx' autopatcher Edited June 20, 2011 by Molecule
jaclaz Posted June 20, 2011 Posted June 20, 2011 (edited) SET %OLDEST%=%%A Sets the VALUE OF the OLDEST variable to have the VALUE OF FOR loop variable A. SET OLDEST=%%A Sets the OLDEST variable variable to have the VALUE OF FOR loop variable A.Or, if you prefer, the actual variable is called "OLDEST" and "%OLDEST%" is expanded to the VALUE it was SET to.Apart from this, the FOR /F needs a modified command.com (actually a CMD.EXE).See here:http://www.computerhope.com/forhlp.htmhttp://reboot.pro/2392/jaclaz Edited June 20, 2011 by jaclaz
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now