How to modify attributes from the command line / script.
You can use attrib command to modify attributes from the command line.
Syntax of the command:
ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H] [drive:][path][filename]
[/S [/D]]
+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
[drive:][path][filename]
Specifies a file or files for attrib to process.
/S Processes matching files in the current folder
and all subfolders.
/D Processes folders as well.
Parameters – Description
+r or –r Sets or remove the read-only attribute of the file or folder.
+h or –h Sets or remove the hidden attribute of the file or folder.
+s or –s Sets or remove the system attribute of the file.
+a or –a Sets or remove the archive attribute of the file.
/d Apply attributes to all directories.
/s Apply attributes to all files and subdirectories.
EXAMPLES:
View Attributes
C:\WIN2000\STANDARD\I386>attrib
A R C:\WIN2000\STANDARD\I386\0401.CS_
A R C:\WIN2000\STANDARD\I386\0404.CS_
A R C:\WIN2000\STANDARD\I386\0405.CS_
Change Attributes
Attrib +r C:\WIN2000\STANDARD\I386\0212.CSV
Written by: Matthew Long, MCSE 2000