Windows Hidden File Attribute

Recently, I used xcopy to backup all the files from a bad hard drive to another drive under Windows XP. After all the files got copied, the directory is hidden and cannot be seen. I tried to use attrib.exe to remove the hidden attribute, however the command warned me that the directory's system attribute is set and I cannot change it.

H:>attrib -h enterprise

Not resetting system file - H:enterprise



H:>attrib -a enterprise

Not resetting hidden file - H:enterprise



H:>attrib -a -h enterprise

Not resetting system file - H:enterprise

I then tried to read the online help. It turns out I need to specify the /s and /d switches, too. So, the command should be used like this.

H:>attrib /s /d -s -h enterprise

This post may contain affiliated links. When you click on the link and purchase a product, we receive a small commision to keep us running. Thanks.


14 Comments

  1. Hello,

    There is a ‘system’ attribute that is also available with file properties. You must remove that attribute if you want to change the hidden attribute.

    You do not have to use /s /d switches unless all files and subfolders are hidden and system also.

    In your third example, changing -a with -s would have worked.

    H:>attrib -s -h enterprise

  2. Klashma,

    Thanks for your input. I have tried the command without /s /d, but it didn’t work for this particular directory. I’ll try it again next time I ran into the same problem.

    • Aaaaw…

      Missing a basic functionality that’s been around since DOS 3.0, eh?

      Cry me a river.

      You can GET a program that will allow you to do this, but like everything else linux it requires jumping through 10 hoops (the last covered in flaming dog poo) and, of course, 4x the time the entire process would take on a WinPC, Mac, EVEN OS/2!!!!

      For real: You want a cheap (free) operating system, you get one…

  3. A bit late to the commenting, I suppose, but mtools (short for MS-DOS Tools) is just the thing baskoro is looking for. It includes a mattrib command for manipulating the attributes. I used to be quite fond of using it with a script to save all filenames and attributes to a text file, remove all the system and read-only attributes, switch over to Windows, do a _really_ complete defrag, then back to Linux to restore the attributes as they had been with another script. I’m not dual-booting these days, and don’t have the scripts handy, or I’d offer them as well, in case they’d be of interest. But, at least mtools does have what you’re looking for.

    Added afterthought: I don’t know whether, or how well, it handles NTFS. But I know FAT32 is a piece of cake for it.

  4. Randy,
    Thanks for the great info. It’s never too late to comment. The future reader can still benefit from your input.

  5. When I use attrib /S /D -s -h only the attribute of the this folder get changed. The sub-folders are not changed.
    May be due to a virus the attributes of all my folders on my pendrive have changed to System/ Hidden.
    Any suggestion. Thanks.

  6. Hi.
    Thank You , Very …. Very … Much

    This command file has changed me : setupp.exe ( attribute +h +s by trojan.win32.agent)

    good luck.

  7. Hi yaa,

    Great….ton of thanks ๐Ÿ™‚

    Really the below command is working for XP

    H:>attrib /s /d -s -h [enterprise]

    enterprise – folder name… can be used as [*.*]

    Thanks…. ๐Ÿ™‚

Leave a Reply