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.

猜你喜欢

转载自www.cnblogs.com/chucklu/p/10218242.html