Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a command on the Windows command-line that can list hidden folders?

I've tried dir -a:dh but that doesn't work for me.

share|improve this question
up vote 14 down vote accepted

Use the following command:

dir /a:hd C:\folder\

The difference between what you were typing and this command is that you were using a - to indicate the switch, not a /. In most windows command line applications, this doesn't matter, but in the case of the dir command, you must use a slash, not a dash.

The /a switch changes which attributes are displayed. h shows hidden files and d shows just directories. Make sure you keep the trailing slash on the end of the folder path. I just tested, and it worked fine.

share|improve this answer
What's the point of the : character in /a:hd? Omitting it and simply doing dir /ah seems to work well.... – Pacerier Apr 25 '15 at 20:24

Process To View All The Hidden Files And Folder using Command Prompt in Windows:

  1. Open Command Prompt (CMD.exe) as an Administrator.
  2. Navigate to the drive whose files are hidden and you want to recover.
  3. Type attrib -s -h -r /s /d *.* and hit Enter.
  4. That is it. Now you will get all the hidden files and folder as general files and you can use it.
share|improve this answer
What's it supposed to do? Why do I get "Access denied" even when cmd.exe is run as administrator? – Pacerier Apr 25 '15 at 20:26
This is not just showing the files, it is changing their attributes, which might have unexpected consequences, depending on where you do this. – Ale Apr 18 at 11:28
  • dir/a should show hidden folders.
  • dir /a:d shows all directories.
  • dir /a:h shows all hidden files.

Try dir /adh (without the colon) to combine.

share|improve this answer
And "dir /ad-h" shows only non-hidden directories, like "dir". – Andrew J. Brehm Apr 30 '11 at 11:40
Why the down vote? The answer is correct. – Andrew J. Brehm Apr 30 '11 at 17:26
Btw if we only do dir /ad (as opposed to dir /ad-h and dir /adh), what's the default h behavior? – Pacerier Apr 25 '15 at 20:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .