How to hide files using the Attrib command
Attrib is a DOS command that sets or displays various file attributes. One of those attributes is the Hidden attribute, which determines whether or not a file can be viewed in a directory under normal circumstances. With the Attrib command, you are able to hide or show any non-system file, as well as view any file's current attributes.
To use Attrib, you must be at the DOS command prompt. In Windows XP, Vista, and 7, you can open a command prompt window by either typing "cmd" into the Run bar or by browsing to the Command Prompt (Start menu > All Programs > Accessories > Command Prompt). In Vista or 7, you can also type "cmd" into the Search bar.
The syntax for using Attrib to hide a file is as follows:
attrib <path><filename> +h
If you are currently in the directory where the file is located, you can omit typing the path. And since DOS is not case sensitive, you can use either upper or lowercase letters, or both.
If you later want to make that same file visible again, just type:
attrib <path><filename> -h
To view the attributes of all of the files in the current directory (even hidden files), type "attrib" by itself. Keep in mind that hiding a file will make it harder to find, but it does not by any means make it impossible. If you have sensitive or confidential data that should not be viewed by other users, protect it using encryption, permissions, and a strong user account password.
×