If you want to make in command line in windows all files and directories non-hidden attrib -s -h * will not work.

  • 2
    Before you do this, are you just trying to view the hidden files in Explorer? If yes, you only need to edit a setting in Windows Explorer... not permanently discard the hidden setting of files! (Folder options > View > Show hidden files, folder and drives / Hide protected operating system files)
    – ADTC
    Sep 15 '13 at 19:45
  • @ADTC Notice the self-answer.
    – user
    Sep 15 '13 at 19:46
  • 1
    Yes, just want to warn the asker that his command line script will permanently discard the hidden and system attribute for all files on his disk, whereas the options I mention will simply show these files in Explorer. It really looks like he just wants to see the files, not actually change their attributes to visible/non-system (I would consider changing them system-wide a very bad thing to do).
    – ADTC
    Sep 15 '13 at 19:48
  • 1
    Is this a question? Sep 15 '13 at 20:01

You didn't mention which OS are you using, but since the command that you used

attrib -s -h *

didn't work, I'm guessing you used it without administrator priviliges.

The method I use is:

Run command prompt (Start -> Run -> CMD for XP, or for Vista and 7 Start -> type CMD in search box, right click and run as Administrator), type the following command:

attrib -H -S D:\yourfolder\*.* /S /D

This will remove the Hidden and System attribute of all files in the yourfolder folder on the D: drive.

The /S and /D arguments are optional.

/S will recurse down into all sub folders and

/D will unhide the folders themselves if they have the System or Hidden attribute set.

I regularly use this to clean customer virus infected flashdrives, as some viruses tend to hide your files and replace them with infected copies of the virus itself.


For hidden files:

for /f "delims=|" %x in ('dir /a:h /b') do @attrib -h "%x"

For system hidden files:

for /f "delims=|" %x in ('dir /a:sh /b') do @attrib -s -h "%x"

These will affect all hidden (and system) files and directories in the current directory

  • 2
    please take note of the comments
    – ADTC
    Sep 15 '13 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.