Introduction

In this article we discuss how to hide or unhide folders using the attrib command in a command prompt window. The attrib command is very helpful for hiding a folder completely, in other words by using attrib command our folder is hidden and isn't visible when we select to show all files and folders. This command provides security benefits for our software programs and important documents from other users.

What is attrib?

The attrib command is a Windows command prompt command. The main purpose of this command is to remove and set file attributes (hidden, read-only, system and archive). The attributes provide security to software programs. It displays, sets or removes the read-only, hidden and archive file attributes assigned for a file or directory.

It allows a user to change the file attribute directly using this command. Let's understand how it works.

There are four attributes in Windows files

Parameters of attrib command

How to hide or unhide folders and files

The main advantage of hiding using the attrib command is that when we click on the show hidden files option in Windows then the file or folder isn't shown.

For hiding files and folders we need to use a procedure. In the following scenario I first created a new folder to show how to hide or unhide a folder.

Choose the destination folder that you want to hide or unhide. I created a new folder (A) in my E: drive.

Step 1

Open the command prompt.

To open the command shell 1, press Window+r and type "cmd" then press Enter or select from the startup menu.

fig-1.jpg

Step 2

Now go to the drive where your folder is stored in the drive. Let's use my new folder (A) stored in the E: drive then I type:

E:

Then press Enter as in the following,

fig-2.jpg

Step 3

Now to hide the folder we need to type in the following command:

E:(drive_name where your folder exist) attrib folder_name +s +h +r

As in the following.

fig-3.jpg

Now you see the advantage of this command. Open your drive and check that your destination folder will not be there since it is now hidden.

Hiding using this command will provide you the extra advantage that they aren't visible when you show your hidden folder through "Organize" -> "Folder and search" -> "view" -> "show hidden files and folders".

Step 4

Now type in the following command to unhide the folder:

E:(drive_name where your folder exist) attrib folder_name -s -h -r

As in the following,

fig-5.jpg

Note

If you want to hide your destination folder completely then you need to delete your recent visit list from your system.