Reminder: For loop on the commandprompt

Published 10 April 8 10:52 AM | Ramon Smits

I always forget how to loop through a set of files on the command prompt. For this reason I'm blogging this as a reminder for future reference. 

FOR %A IN (*.txt) DO ECHO %a

In a batch/command file the % character needs to be escaped with an additional %.

FOR %%A IN (%1) DO ECHO %a

Filed under:

Comments

# Pieter Joost van de Sande said on April 16, 2008 6:36 AM:

Bookmarked as a reminder to :)