Showing posts with label ATTRIB. Show all posts
Showing posts with label ATTRIB. Show all posts

Friday, February 29, 2008

ATTRIB

The ATTRIB command can be used to make files hidden, read-only, system, and archive. To change a file that is visible to a hidden file, you would enter ATTRIB +H and the filename with it's extension at the C:\ prompt in the directory that contains the file. Such as C:\ATTRIB +H visible.doc. To make a file read-only prevents any unwanted changes from occurring. At the C:\ prompt you would enter C:\ATTRIB +R readme.doc. This command will deny access to anyone trying to make changes or delete the file. To remove the read-only attribute from the file, enter C:\ATTRIB -R readme.doc.
Some of the switches associated with the ATTRIB command are:
+H to hide a file in a directory
-H to view a previously hidden file
+A to set a file flag so it can be archived during a backup or XCOPY
-A to remove the archive flag
+S to set a file as a system command
-S to remove the flag for a system command file
+R to set the file up for read-only
-R to remove the read-only attribute

You can also use multiple switches with the ATTRIB command. For instance, if you wanted to set a file up as a system file that is hidden. You would enter the ATTRIB command: C:\ATTRIB +S +H helloworld.exe. To reverse these settings you would substitute the +S +H with the -S -H switches.