Hinge for hidden folders in Windows

How can I iterate over all hidden folders in windows-cmd?

This code

FOR /D %i IN (*) DO @echo %i 

handles only non-hidden folders.

+3
source share
1 answer

To iterate over the entire folder in a directory (including hidden folders) in cmd, you can use:

FOR /F "tokens=*" %i IN ('DIR /A:D /b') do @echo %i

You can exclude the system folder using:

FOR /F "tokens=*" %i IN ('DIR /A:D-S /b') do @echo %i

And if you want to get subfolders (you may not want this in a folder with many subfolders):

FOR /F "tokens=*" %i IN ('DIR /A:D /s /b') do @echo %i
+6
source

All Articles