开发者

FOR loop in batch file question

开发者 https://www.devze.com 2023-02-07 22:37 出处:网络
For the first time ever, im trying to write a simple batch filefor-loop. Here is my (pseudo) code. FOR /f %%f IN (\"alpha\",\"bravo\",\"charlie\") DOecho %%f

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 i开发者_开发技巧n the brackets (i.e. seperated by a comma).

alpha
bravo
charlie

It currently just prints alpha".


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消