Attrib Command (Examples, Options, Switches, and More)
Introduction
The attrib command is a useful tool within the Windows operating system to manipulate the attributes of files and folders. With this tool, users can alter the attributes with ease. Below is an overview of the attrib command and its features.
Commands and Switches
Here are some of the most common attrib commands:
attrib +h [foldername/file.extension] – This will hide a file or folder, making it invisible to users.
attrib –h [foldername/file.extension] – This reverses the hidden attribute and makes a hidden file or folder visible again.
attrib +s [foldername/file.extension] – This marks a file or folder as system files.
attrib –s [foldername/file.extension] – This reverses the system attribute and removes the system file designation.
attrib +a [foldername/file.extension] – This adds the archive attribute, marking it to be archived.
attrib –a [foldername/file.extension] – This reverses the archive attribute and removes the archive designation.
Options and Switches
The attrib command offers various options and switches to further modify the attributes of a file or folder. An exhaustive list of these options can be accessed by using the attrib /? command.
Some common switches include:
/R – This switch sets the attrib command to make changes recursively to folders, meaning that it will also change the attributes of all files and subfolders within the parent folder.
/S – This switch sets the attrib command to look for files in a specific folder and all its subfolders.
/D – This switch sets the attrib command to only apply changes to folders, not their contents.
Conclusion
The attrib command is a powerful tool that enable advanced users to manipulate the attributes of files and folders in the Windows operating system. Commands can be used in combination with switches to further modify file and folder properties. By learning how to use attrib commands, users can improve their efficiency and control over their files and folders.