5

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

Oliver Salzburg
  • 86,445
  • 63
  • 260
  • 306
Alexey
  • 363
  • 1
  • 3
  • 8
  • 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? – Ƭᴇcʜιᴇ007 Sep 15 '13 at 20:01
  • possible duplicate of [How can I recursively clear the "Hidden" file flag on Windows Vista?](http://superuser.com/questions/295231/how-can-i-recursively-clear-the-hidden-file-flag-on-windows-vista), [Windows: How turn off hidden attribute for all files and directories on a drive?](http://superuser.com/questions/366561/windows-how-turn-off-hidden-attribute-for-all-files-and-directories-on-a-drive) – Ƭᴇcʜιᴇ007 Sep 15 '13 at 20:03
  • @techie007 Possibly. We still don't know whether he just wants to see them, or if he actually wants them unset as hidden and system. – Blacklight Shining Sep 15 '13 at 20:10
  • @BlacklightShining He specified trying to use "Attrib", which removes the actual hidden attribute. Which is also what his title specifically refers to. The solution he himself posted specifically removes the attribute, so I'm going to say that there's no reason to assume that's not what he wants to do. ;) – Ƭᴇcʜιᴇ007 Sep 15 '13 at 20:17
  • Related: [Quickest way to see hidden files on Windows?](http://superuser.com/questions/185122/quickest-way-to-see-hidden-files-on-windows?rq=1) – Ƭᴇcʜιᴇ007 Sep 15 '13 at 20:19

2 Answers2

11

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.

slavmaf
  • 404
  • 3
  • 7
0

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

Alexey
  • 363
  • 1
  • 3
  • 8