How to hide a folder in windows using attrib command
This post explains how to hide folders in windows operating system. The folders will be still hidden even though you check the 'Show hidden folders' option. This method uses the ATTRIB command.
ATTRIB Command:
In windows operating system, every file or directory will have some attributes or properties which can be edited by attrib command.
H - Hidden file attribute
S - System file attribute
R - Read Only attribute
C - Compressed/Archived file attribute
All these attributes are supported by all versions of windows. The latest versions of windows have additional attributes too which are not listed here.
Syntax: attrib [{+r|-r}] [{+a|-a}] [{+s|-s}] [{+h|-h}] [[DriveName:][DirPath] FileName] [/s[/d]]
Parameters:
+h –Sets the hidden file attribute
-h - Clears the hidden file attribute
+s - Sets the system file attribute
-s - Clears the system file attribute
+r - Sets the read only file attribute
-r - Clears the read only file attribute
+c - Sets the compressed file attribute
-c - Clears the compressed file attribute
[[DriveName:][DirPath] FileName] - This can be full path to either a directory or a file.
/s – Applies the attribute values to the matching directories and all its subdirectories
/d – applies only to the mentioned directory
Hiding folders or files using the ATTRIB Command:
By modifying the above mentioned attributes of a file/directorywe can hide a file/directory.
Command: attrib +h +s +r C:\MyFolder