1) Yes, note that the /F switch means "every line" not "a line".
2) Yes
3) Every line of the command output if there are more than one e.g. DIR, TYPE, whatever
4)
treat line as a series of tokens split by delim chars (default are space and TAB)
specify others in delims= (delims block) e.g. "delims=,.:"
tokens=[specify tokens]
The first token (the one specified in the FOR line) is the EXPLICIT token.
There may be up to 25 more IMPLICIT tokens in one FOR structure. (Because there are 26 letters of the alphabet)
These follow in sequence and are specified by the tokens= part.
e.g.
FOR /F "tokens=1-3* delims=," %%A in ("cat,dog,horse,the whole zoo") do (
echo token 1: %%A
echo token 2: %%B
echo token 3: %%C
echo the rest: %%D
)
%%A is cat, %%B is dog, %%C is horse, %%D [created because of the asterisk which means "the rest"] is the whole zoo
token 1: cat
token 2: dog
token 3: horse
the rest: the whole zoo
5) Yes
6) Walks the directory tree starting at a top folder, i.e. successively repeats the command for every file specified in (set) in that folder and every sub(and sub-sub, sub-sub-sub, etc) folder in turn
This code echoes the path and filename of every mp3 file in C:\Myfolder and all subdirectories
FOR /R "C:\MyFolder" %%A in (*.mp3) do (
echo %%A
)
7) lists directories.
for /D %%A in (C:\) do echo %%A echoes C:\
for /D %%A in (C:\*) do echo %%A echoes all next level sub directories
for /D %%A in (C:\B*) do echo %%A echoes all next level sub directories whose name starts with B
can't write 8 )
use different symbol like 8: or 8] or 8.
9) set can be a wildcard or a filename
Note quotes; optional if %%A never has spaces, compulsory if there are spaces
for %%A in (*.bat) do (
copy "%%A" D:\NewFolder
)
PS. Can FORs be nested?
Yes, but you cannot have more than a certain number of variables active. FOR /? help says max is 52 (A-Z, a-z) but in fact you can use 1-9 and a few other characters as well. I think it is 63 or 64 but beyond 52 is undocumented.