Iterate a folder in CMD

article #519, updated 4011 days ago

Try this:

@echo off
for /D %%Q in (C:\*) do echo Directory:  %%Q
for %%Q in (C:\*) do echo File:  %%Q

The above is a solid batch file — if you use the logic in the command shell, use single percents, not doubles!

Categories: