< Day Day Up > 

In Windows, files and folders have certain properties (called attributes) that can be configured. If you right-click on the file or folder's icon, you'll see some check boxes that allow you to change these attributes. The ATTRIB command allows you to do this when the Windows GUI is not available. The possible attributes, which vary based on Windows version and other factors, are as follows:

Read only: When set, this allows the file to be opened and viewed, but not changed or deleted.

Archive: This attribute affects whether the file will be backed up in certain backup schemes using a backup program, or whether running the XCOPY command will copy that particular file. For more information, see Windows Backup help files.

System: This indicates that the file is necessary for some Windows process.

Hidden: Windows hides certain files by default; however, any file can be hidden or displayed by changing this attribute. In 2000 and XP, when the user has enabled the showing of hidden files (in any Windows folder in Tools > Folder Options > View tab), icons for hidden folders and files appear translucent.

The most common repair use for the ATTRIB command is to replace corrupted registry files in 9x (see Chapter 11, "Troubleshooting," for more information).

When run without switches, ATTRIB shows the attributes of each file in the current folder.

ATTRIB displays, sets, or removes the read-only, archive, system, and hidden attributes assigned to files or folders. Used without parameters, ATTRIB displays attributes of all files in the current folder.


ATTRIB uses the plus sign (+) to turn on an attribute, and the minus sign (-) to turn off an attribute. To use ATTRIB, navigate to the folder where the desired file is located (see the CD command description later in this appendix), and type the command followed by the filename (with or without wildcards) and the desired parameters and switches.


+r: Sets the read-only file attribute.

-r: Clears the read-only file attribute.

+a: Sets the archive file attribute.

-a: Clears the archive file attribute.

+s: Sets the system file attribute.

-s: Clears the system file attribute.

+h: Sets the hidden file attribute.

-h: Clears the hidden file attribute.


/s: Applies the command to matching files in the current folder and all its subfolders.

/d: Applies the command to the entire folder.


  • To apply a change to a group of files using wildcard characters, files with their system and/or hidden attributes will not be affected unless you turn off the hidden and system attributes first.


To display the attributes of a file named chapter07.doc, navigate to the folder and enter:

ATTRIB chapter07.doc 

To assign the read-only attribute to the file, enter:

ATTRIB +r chapter07.doc 

To remove the read-only, hidden, and system attributes from all .reg files on the C: drive, including in all subfolders, navigate to the C: drive and enter:

ATTRIB -r -h -s *.reg /s 

 < Day Day Up > 

PC Repair and Maintenance(c) A Practical Guide
PC Repair and Maintenance: A Practical Guide (Charles River Media Networking/Security)
ISBN: 1584502665
EAN: 2147483647
Year: 2004
Pages: 175

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: