G-Stress Posted June 19, 2007 Share Posted June 19, 2007 Hey guys, I am a complete n00b with batch scripting. I find it understandable for the most part, but some can be a bit confusing. I'm trying to understand exactly what is going on in this script I found to copy images from a camera drive and save them to the current user's mydocuments/mypic's folder: http://www.tech-recipes.com/rx/1952/xp_bat...rganize_by_date It seems fairly understandable, but what is confusing me and I can't understand even after a couple hours of googling is the part specifying the date FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET CDATE=%%B FOR /F "TOKENS=1,2 eol=/ DELIMS=/ " %%A IN ('DATE/T') DO SET mm=%%B FOR /F "TOKENS=1,2 DELIMS=/ eol=/" %%A IN ('echo %CDATE%') DO SET dd=%%B FOR /F "TOKENS=2,3 DELIMS=/ " %%A IN ('echo %CDATE%') DO SET yyyy=%%B SET date=%mm%%dd%%yyyy% with the FOR command. I slightly understand the TOKENS and DELIMS part, but what is %%A? To my understanding from googling that appears to be a variable, but I do not see it defined anywhere else in this script or understand what it does or %%B What I get from looking at that portion of the code is the variables should only be mm dd and yyy. Also anyone know of any video tutorials that provide Windows Shell Scripting/Batch Filing? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
SomeoneE1se Posted June 19, 2007 Share Posted June 19, 2007 Doesn't windows do this automagicly Quote Link to comment Share on other sites More sharing options...
elmer Posted June 19, 2007 Share Posted June 19, 2007 Yes, %%A is a variable, but just as any other %%[letter] it does not need to be defined and is used mainly for the FOR command. Quote Link to comment Share on other sites More sharing options...
G-Stress Posted June 20, 2007 Author Share Posted June 20, 2007 @ elmer Ok I kinda thought that, but what exactly is it doing? It's purpose for the mentioned lines of code? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.