Export (0) Print
Expand All
Arp
At
Cd
Cls
Cmd
Del
Dir
Fc
For
Ftp
If
Ldp
Lpq
Lpr
Md
Mmc
Msg
Nlb
Rcp
Rd
Reg
Rem
Ren
Rsh
Rsm
Rss
Sc
Set
Sfc
Ver
Vol
Expand Minimize
27 out of 45 rated this helpful - Rate this topic

Attrib

Published: April 17, 2012

Updated: April 17, 2012

Applies To: Windows 8, Windows Server 2008, Windows Server 2012, Windows Vista

Displays, sets, or removes attributes assigned to files or directories. If used without parameters, attrib displays attributes of all files in the current directory.

For examples of how to use this command, see Examples.

attrib [{+|-}r] [{+|-}a] [{+|-}s] [{+|-}h] [{+|-}i] [<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.

{+|-}s

Sets (+) or clears (-) the System file attribute.

{+|-}h

Sets (+) or clears (-) the Hidden file attribute.

{+|-}i

Sets (+) or clears (-) the Not Content Indexed file attribute.

[<Drive>:][<Path>][<FileName>]

Specifies the location and name of the directory, file, or group of files for which you want to display or change attributes. You can use the ? and * wildcard characters in the FileName parameter to display or change the attributes for a group of files.

/s

Applies attrib and any command-line options to matching files in the current directory and all of its subdirectories.

/d

Applies attrib and any command-line options to directories.

/l

Applies attrib and any command-line options to the Symbolic Link, rather than the target of the Symbolic Link.

/?

Displays help at the command prompt.

  • You can use wildcard characters (? and *) with the FileName parameter to display or change the attributes for a group of files.

  • If a file has the System (s) or Hidden (h) attribute set, you must clear the attribute before you can change any other attributes for that file.

  • The Archive attribute (a) marks files that have changed since the last time they were backed up. Note that the xcopycommand uses archive attributes.

To display the attributes of a file named News86 that is located in the current directory, type:

attrib news86 

To assign the Read-only attribute to the file named Report.txt, type:

attrib +r report.txt 

To 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\*.* /s 

To 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:*.bak 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.