maxp
maxp

Reputation: 25141

FOR loop in batch file question

For the first time ever, im trying to write a simple batch file for-loop.

Here is my (pseudo) code.

FOR /f %%f IN ("alpha","bravo","charlie") DO  echo %%f

The intended output is for it to run the command for each word in the brackets (i.e. seperated by a comma).

alpha
bravo
charlie

It currently just prints alpha".

Upvotes: 0

Views: 544

Answers (1)

Eric Fortin
Eric Fortin

Reputation: 7603

Remove /f so this is

FOR %%f IN ("alpha","bravo","charlie") DO  echo %%f

edited answer to remove the separated by spaces as I wasn't aware that you can use either space or commas to separate element of list.

Upvotes: 3

Related Questions