Hide folder and unhide folder using command line (cmd)

 

Hide and Unhide a Folder Using CMD in Windows

Using the attrib command in Command Prompt

In Windows, we can hide or unhide a folder using the Command Prompt (CMD) with the help of the attrib command. This method is simple and does not require any third-party software.


1. What is attrib Command?

The attrib command is used to display, set, or remove file and folder attributes.

Some important attributes:

  • +h → Hide the file/folder

  • -h → Unhide the file/folder

  • +s → System file

  • -s → Remove system attribute


2. Steps to Hide a Folder Using CMD

Step 1: Open Command Prompt

  • Press Windows + R

  • Type cmd

  • Press Enter

Or search Command Prompt in the Start menu.


Step 2: Go to the Folder Location

Use cd command to navigate.

Example:

cd Desktop

If your folder is inside another folder:

cd Desktop\MyFolder

Step 3: Hide the Folder

Use this command:

attrib +h FolderName

Example:

attrib +h Secret

Now the folder Secret will be hidden.

If you want stronger hiding (system + hidden):

attrib +h +s Secret

3. How to Unhide the Folder Using CMD

To make the folder visible again:

attrib -h FolderName

Example:

attrib -h Secret

If you used system attribute also:

attrib -h -s Secret

Now the folder will be visible again.


4. Important Notes

  • Hidden folders can still be seen if:

    • "Show hidden files" is enabled in File Explorer.

  • This method is not password protection.

  • It is only basic privacy, not strong security.


5. Advanced (Hide All Files Inside Folder)

To hide folder and all files inside it:

attrib +h +s FolderName /s /d

To unhide everything:

attrib -h -s FolderName /s /d

Where:

  • /s → Applies to all files in subfolders

  • /d → Applies to folders also

You can also add . for represent the entire directory is hide or unhide

attrib -h -r -s /s /d *.* => this is the all in one code that make the file unhide from hovering dire.

Post a Comment

0 Comments