Assuming I have a bunch of
for /F "tokens=*" %a in ('dir /b *.cmd') do call "%a"
This just loops over the result of
dir /b *.cmd calling each in turn.
explanation from the docs:
FOR /F processing of a text file consists of reading the file, one line of text at a time and then breaking the line up into individual items of data called 'tokens'. The DO command is then executed with the parameter(s) set to the token(s) found.
So my command says:
"tokens=*"don't give me individual tokens, give me the whole line as one hit
%a- name the line variable %a (note: it'll needs to be escaped as %%a if you're putting it in a batch file
('dir /b *.cmd')This is the input that it'll loop over. A bare directory listing for all .cmd files
If I didn't add the tokens bit it would work fine until you find a space in the file names.