‚Č° Menu

Attrib command : Set file attributes from command line (CMD)

We can use ‘attrib’¬†command to set/unset file attributes. Let us see how to use this command to manipulate different file attributes from windows command line(CMD). Take a sample file example.doc

To set archive attribute for the file example.doc:

attrib +a example.doc

To unset archive attribute:

attrib -a example.doc

To set read only attribute:

attrib +r example.doc

To unset read only attribute:

attrib -r example.doc

To make the file hidden :

attrib +h example.doc

To remove the hidden attribute:

attrib -h example.doc

To set system file attribute:

attrib +s example.doc

To unset system file attribute:

attrib -s example.doc

This attrib command works on all Windows editions(XP, Vista, Windows 7, Server 2K3 & 2K8)

Relevant links:

Attrib command: Not resetting hidden file
Attrib command: Not resetting system file

{ 8 comments… add one }
  • Ricky

    i have used "ATTRIB" command two month before and i have hidden some kind of files … but now i forgot the file name … may i know how to get my file name "ATTRIB". i know how to unset for "ATTRIB".. but just forgaot my file name.. please any one help me how to get file name from "ATTRIB" command…………

  • Techblogger

    Ricky,
    You can get the file name in two ways..open the directory in explorer window and enable 'show hidden files and folders' in Tools->Folder options->View. After this you should be able to see all the hidden files in that folder…

    The other way is through command line. cd to the folder where you have the hidden files and press Tab key. You will see the name of the file that comes first in alphabetical order.. keep on pressing Tab key until you get the hidden file you created..

  • Techblogger

    And one more simple way is to run the command 'attrib -h * '. this will remove hidden flag for all the files in that directory..

  • Anonymous

    i dont know how to use this 'atrib -h*t'

    but this option works good…. thanks

    'cd to the folder where you have the hidden files and press Tab key. You will see the name of the file that comes first in alphabetical order.. keep on pressing Tab key until you get the hidden file you created..

  • Lalit kirar

    my command prompt doesn’t support the attrib command …
    what should i do now.
    thanks

    • admin

      Which Windows release and edition you are using?

    • not Lalit kirar

      i think you should remove your C:\

  • jherimy

    what command i can used to return the file of my flush-drive? thnks

Leave a Comment