This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
Displays, sets, or removes attributes assigned to files or directories. If used without parameters,attrib displays attributes of all files in the current directory.
attrib [{+|-}r] [{+|-}a] [{+|-}s] [{+|-}h] [{+|-}o] [{+|-}i] [{+|-}x] [{+|-}p] [{+|-}u] [{+|-}b] [<drive>:][<path>][<filename>] [/s [/d] [/l]]| Parameter | Description |
|---|---|
{+\|-}r | Sets (+) or clears (-) the Read-only file attribute. |
{+\|-}a | Sets (+) or clears (-) the Archive file attribute. This attribute set marks files that have changed since the last time they were backed up. Thexcopy command uses archive attributes. |
{+\|-}s | Sets (+) or clears (-) the System file attribute. If a file uses this attribute set, you must clear the attribute before you can change any other attributes for the file. |
{+\|-}h | Sets (+) or clears (-) the Hidden file attribute. If a file uses this attribute set, you must clear the attribute before you can change any other attributes for the file. |
{+\|-}o | Sets (+) or clears (-) the Offline file attribute. |
{+\|-}i | Sets (+) or clears (-) the Not Content Indexed file attribute. |
{+\|-}x | Sets (+) or clears (-) the Scrub file attribute. |
{+\|-}p | Sets (+) or clears (-) the Pinned file attribute. |
{+\|-}u | Sets (+) or clears (-) the Unpinned file attribute. |
{+\|-}b | Sets (+) or clears (-) the SMR Blob file attribute. |
[<drive>:][<path>][<filename>] | Specifies the location and name of the directory, file, or group of files that you want to view or change attributes. You can use the? and* wildcard characters in thefilename parameter to display or change the attributes for a group of files. |
| /s | Appliesattrib and any command-line options to matching files in the current directory and all of its subdirectories. |
| /d | Appliesattrib and any command-line options to directories. |
| /l | Appliesattrib and any command-line options to the Symbolic Link, rather than the target of the Symbolic Link. |
| /? | Displays help at the command prompt. |
To display the attributes of a file named News86 that is located in the current directory, type:
attrib news86To assign the Read-only attribute to the file named report.txt, type:
attrib +r report.txtTo remove the Read-only attribute from files in the public directory and its subdirectories on a disk in drive b:, type:
attrib -r b:\public\*.* /sTo set the Archive attribute for all files on drive a:, and then clear the Archive attribute for files with the .bak extension, type:
attrib +a a:*.* & attrib -a a:*.bakWas this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Was this page helpful?
Want to try using Ask Learn to clarify or guide you through this topic?