In this article we will discuss how to hide or unhide folders using command prompt.

Hiding Files and Folders from others is very common. Anyone can see hidden files on your computer by simply checking the Hidden Items in Windows Explorer. But in this method no one can see your folders except you.

This method provides security for your programs and important documents from other user.

What is attrib command ?

The attrib is a Windows CMD command which is used to set and remove file attributes. The attributes provide security to essential documents. It sets,displays and removes hidden, readonly archive file atrributes which is assigned for a directory or file. By using this command directly user can change the attributes of file.

There are four attributes in Windows files

  • Hidden
    • It makes files or folders invisible to the user to provide security for files or folders.
  • Archived
    • It provides a backup of file. Hence help in recovering of files and folders.
  • System
    • It is used to mark the files as an important system file, so it changes the priority of the file.
  • Read-Only
    • This attribute means that no one can delete or make changes to that specific file.

Parameters of attrib command

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

-s : Clears the system file attribute.

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

-r : Clears the read-only file attribute.

+a : Sets the file attribute as archive.

-a : Clears the archive file attribute.

+h : Makes the file attribute as hidden not visible to use.

-h : Clears the Hidden file attribute.

Method 1

To Hide File or Folder

hide files folders

  1. Open the folder or Go to the folder containing the file from your Windows Explorer. To hide the file or folder first copy the address or path of that folder or file.


hide files folders

2. Open Run by Right Clicking on Start Menu or Using Keyboard Shortcut (Ctrl+R).

hide files folders3. Type cmd and Click on OK or Hit Enter. This will open Command Prompt.

hide files folders

4. In CMD, type attrib +s +h “Path To Your File”. Hit Enter. This is a command to hide your file or folder.

NOTE – You must know the folder/file path to unhide. If you forget the name of the file or folder, then Open Command Prompt and Enter the following command.

hide files folders

Type the drive name with : and press Enter. Type dir/a command and hit Enter. Now find your file or folder name from the list.

To Unhide File or Folder

hide files folders

  1. Open Command Prompt by typing cmd in Run.


hide files folders

2. To Unhide your file or folder, type attrib -s -h “Path to file or folder”. Press Enter Key. After doing this your file or folder will be unhidden.


Please enter your comment!
Please enter your name here