Attrib Command In Windows Server 2008

In this article I will discuss about how to use the arttrib command in Windows Server 2008.
  • 4547


Attrib command applies to Windows  Server  2008,Windows Vista

The use of Attrib command is to display, sets or remove file attributes. Windows files has 4 attributes: Read-only file attribute, Archive file attribute, System file attribute, Hidden file attribute .If it is used without parameter, attrib displays all the file attributes which are in current directory.

Syntax of Attrib Command

attrib [[+r|-r][+a|-a][+h|-h][+s|-s][<Drive>:][<Path>][<File Name>][/s][/d][/l]]


List of Parameters Meaning
[+r|-r] [+r] sets and [-r] removes the Read-only file attribute.
[+a|-a] [+a] sets and [-a] removes the Archive file attribute.
[+h|-h] [+h] sets and [-h] removes the Hidden file attribute.
[+s|-s] [+s] sets and [-s] removes the System file attribute.
[<Drive>:][<Path>][<File Name>] Specifies the location and name of the file or a directory.
/s Apply changes to sub directories of current directory
/d Applies attrib and the command line options to directories
/l Applies to Symbolic Link ,instead of target of Symbolic Link

Examples of attrib command

1.Removes the Read-only and Hidden file attribute for all files in the directories and its sub-directories

attrib -r -h *.*/s/d

2.Sets the Archive attribute for all files ion drive E

attrib +a e:*.*

Ask Your Question 

 Got a programming related question? You may want to post your question here

Programming Answers here


More Articles

© 2020 DotNetHeaven. All rights reserved.