attrib |
modifies, or removes file attributes such as
Read-only, Archive, System, and Hidden.
Syntax
attrib [+r | -r] [+a | -a] [+s | -s] [+h | -h] [ [drive:] [path] filename]
[/s [/d] ]
Options
- +r
Sets Read-only attribute (useful for protecting users from
themselves).- -r
Clears Read-only attribute.- +a
Sets Archive attribute (indicates files that have changed since the
last backup was performed).- -a
Clears Archive attribute.- +s
Sets System attribute. (System files are generally protected
operating-system files.)- -s
Clears System attribute.- +h
Sets Hidden attribute. (By default, hidden files
aren't displayed in Windows Explorer.)- -h
Clears Hidden attribute.- /s
Sets or clears attributes recursively, starting from the current
directory and extending to all subdirectories.- /d
Sets or clears attributes on directories only.- [drive:][path] filename
Indicates location and name of the directory, file, or set of files
whose attributes you want to set or clear. (The wildcards
? and * can also be used.)
Examples
Display the attributes of all directories and files in the current
directory:
attrib
A C:\AUTOEXEC.BAT
A SH C:\boot.ini
A C:\CONFIG.SYS
A SHR C:\IO.SYS
A SHR C:\MSDOS.SYS
A SHR C:\NTDETECT.COM
A SHR C:\ntldr
A SH C:\pagefile.sys
List the attributes of C:\boot.ini (used to
create the Boot Loader menu):
attrib C:\boot.ini
A SH C:\boot.ini
Note that the Archive (A), System (S), and Hidden (H) attributes are
set on this file.Remove the System and Hidden attributes of
boot.ini so the file can be modified (leave the
Archive attribute unchanged):
attrib C:\boot.ini -s -h
View the attributes again:
attrib C:\boot.ini
A C:\boot.ini
Notes
- The file with the System or Hidden attribute set must have these
attributes cleared before you can change any other attributes for
that file. - To display or view advanced attributes such as encryption and
compression state, see cipher in this chapter. - attrib is also available from the Recovery Console.
See Also
cipher, Files and Folders ,
Recovery Console