Windows batch: call more than one command in a FOR loop?

https://stackoverflow.com/questions/2252979/windows-batch-call-more-than-one-command-in-a-for-loop

Using & is fine for short commands, but that single line can get very long very quick. When that happens, switch to multi-line syntax.

FOR /r %%X IN (*.txt) DO (
    ECHO %%X
    DEL %%X
)

Placement of ( and ) matters. The round brackets after DO must be placed on the same line, otherwise the batch file will be incorrect.

See if /?|find /V "" for details.

posted @ 2019-01-04 10:01  ChuckLu  阅读(247)  评论(0编辑  收藏  举报