How to Hide or Unhide Files and Folders Using ATTRIB Command in Windows

Do you want to unhide files or folders hidden by Virus in your Windows Computer? Windows Operating System has "attrib" command for this purpose. Let's go deep into the arrtib command and see how you can hide or unhide files and folders.

Lets talk Little more about attrib before starting implementation:

attrib is a DOS (disk operating system) command to change the attribute of a folder or a file at command prompt. + and  are used to set and clear the attribute respectively. If typed without any switches, attrib will show attributes of all the files in the current directory.

Followings are the attributes available with attrib command:
R - Set the file Read-Only
A - Set Archive attribute to files.
S - System file attributes
H - Hidden file attributes.

Here’s how you can create a hidden folder in Windows in more secure way without using any third party software:

1. Go to Start  Run and then type cmd to open the command prompt window.

2. Now, you need to know the exact path of your folder. To know this, navigate to the parent folder of the folder you want to hide and remember the path. In my case, I want to hide the  C:\Test folder, so I would use CD command to go to the root directory C:\. CD means change directory. This is a DOS command to change directories. Directories can be thought as Folder in Windows.

3. Type attrib +s +h Test in command prompt and hit enter. That's all. Your folder should be completely hidden now even if “Show all Hidden Files and Folders” are selected in View from Folder Options.

4. Now type the same command, replacing the folder name with the name of the folder you want to hide.

5. And that's it.
I understand that after reading this post, you should be comfortable with securing your files and folders in Windows Operating system.

Unhide Instruction: To unhide the same folder, you will have to type  instead of + with attribute switches to remove the attribute . So, type attrib -s -h Test and that would unhide the folder.

Be cautioned to remember the folder or file name with path (i.e which you are going to hide) as there is no easy way to find out the name of the folder / file hidden using “s” switch of attrib command.

Comments