How to hide and unhide files & Folders using the attrib Command

Knowledge
is
Power.

The attrib command is a Windows command prompt command that allows computer users to set file attributes which provide security to files and folders as well as software programs.

Analysis

There are four attributes in Windows files:

Hidden – hides files or folders from visible eye.

Read-only – No changes can be made to a file if the read-only attribute command is issued.

Archived – Backup of files.

System – Marks a file as an important system file.

Command Parameters:

+r : Sets a file attribute as read-only.

-r : Clears the read-only file attribute.

+a : Sets a file attribute as archived.

-a : Clears the archived file attribute.

+s : Sets a file attribute as a system file.

-s : Clears the system file attribute.

+h : Sets a file attribute to hidden

-h : Clears the hidden file attribute.

Application

Do you have important documents in that office computer that you want to protect from other users? Here’s a simple solution to your problem.

Hypothetically, let’s assume the folder which contains all my important documents is named “Dave” and its location is in “Music” folder of my laptop.

Step 1: Press Windows + R key, type “cmd” and press ok. It will display the command prompt window as shown below.

Note that it will display as c:\Users\Your Username> on your own computer.

In your command prompt window, type dir and press enter. It will display the list of directories as shown below.

 

Step 2: Since the folder we want to hide is in Music folder, we need to change directory to Music folder by typing “cd music” and pressing enter as shown below. When it changes to music folder, type “dir” and press “enter” to display music directory (list of files & folders in “Music”) as shown below.

Step 3: Now that the target folder “Dave” has been displayed, issue the following command: “attrib +h dave” and press enter to hide the folder “dave”. By the time you go back to check the Music folder, you will realize that the folder “dave” has been hidden. To make the dave folder visible again, type “attrib -h dave” to unhide the dave folder as shown below:

Don’t forget to replace “Dave” with your target folder accordingly.

    Leave Your Comment Here