Name

attrib

Synopsis

Displays, 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

[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.)

+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 are not 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 (new to Windows 2000).

Examples

Display the attributes of all directories and files in the current directory:

                     attrib

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: ...

Get Windows 2000 Administration in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.