|no problem, it's coffee time anyway! :)|
" do'nt want to be a nuisance but could I also ask if you could explain exactly how the "token=" line works, I'm confused by the explanations if have read"
tokens are "words" taken from a "sentence"
words can be "delimited" by a lot of things:
(spaces) . ! ? ,
(f/e: whatever! i'm done here, i'm going home. bye.)
(sounds like a girlfriend problem!)
"tokens" specifies which "word" or words you want,
"delims" specifies what char or char.s separate the words,
f/e: "tokens=2 delims=," says take the second word that
is counted using a comma.
"tokens=1,2,3 delims=,!." says take words 1, 2 and three
as counted using either , ! or .
applied to the example above you would get
"whatever" as token #1, (delimiter of !)
"i'm done here" as token #2 (delimiter of comma)
"i'm going home" as token #3 (delimiter of period)
the tokens are assigned to the variables on one-to-one basis,
so the first var. gets the first requested word, the second
gets the second requested word, f/e:
"tokens=1,3 delims=,!." %%f in (girlfriend.txt)
puts the first "word" in %%f, and the third word into %%g
(implied: var.s ascend by one value for each requested word).
here is example using your date setup above:
for /f "tokens=2,3,4 delims=-=" %%a in ('find "fileDate="^<myfile.txt') do (
>> newfile echo %newdate%
token #1 is not requested so it is skipped ("fileDate")
tokens 2,3,4 (also expressible as: 2-4) are assigned
to a, b and c respectively, then rearranged by the script.