May 22, 2011, 1:42 a.m.
posted by shadow
The A+ folks are somewhat enamored with the ATTRIB DOS command. As a result, you may encounter one or two questions about how to change the file attributes of a Windows file. The following sections guide you through this process.
Another file-related action that you need to know for the exam is how to change file attributes. The following four file attributes can be set for a file (or folder) in Windows:
Archive: Indicates that a file that is marked to be backed up.
Hidden: Prevents a file from appearing in directory listings.
Read-only: Indicates that a file that can be read but cannot be changed or deleted.
System: Indicates that a file that is used only by the operating system and is not typically displayed in a directory listing.
The ATTRIB command is used to display and modify the file attributes of a file. To view or change the file attributes for one or more files from the command prompt or through Windows Explorer, follow the processes that are described in Labs 19-1 and 19-2.
To display the current attributes of a file, change to the directory of the file and enter the following command:
The system displays something like this:
The series of letters at the beginning of this line are the first letters of the current attributes: A stands for Archive, S is for System, H is for Hidden, and R is for Read-only.
To remove an attribute from a file, use the minus sign (–).
For example, this command example removes the System, Hidden, and Read-only attributes from the file:
ATTRIB –S –H –R MYFILE.DAT
To add an attribute to a file, use the plus sign (+).
For example, this command example adds the Hidden attribute to the file:
ATTRIB +H MYFILE.DAT
In Windows Explorer, right-click the file and select Properties from the pop-up menu that appears.
In the Attributes section of the Properties window, the attributes that are enabled have check marks next to them.
To remove or add an attribute to a file, simply check or uncheck the attributes as you desire.
To change the System attribute, you must use the command prompt (see Lab 19-1).