How to Use Attrib Command to Hide Folder in Windows 10 & 11

Recently, I’ve shown you how to lock a folder with a password using a simple trick and built-in tools. This quick tutorial shows you how to super hide a folder using the attrib command. When I say super hide, I mean that even if you try to unhide the folder using the usual means, it will not appear in the File Explorer.

For example, we select the “Show Hidden Files” option in the File Explorer to see hidden files and folders. However, when you hide a folder or file using the Attrib command, it will be treated differently and not shown.

Though we have to execute a command, it is pretty simple. Let me show you how to use the Attrib command to hide files and folders in Windows 10 and 11.

Table of contents:

Note: The below trick works with older systems like Windows 7 and Windows 8 too.

Method #1 – Hide Folders with Attrib CMD in Command Prompt

To hide a folder with the attrib command, we will use the Command Prompt. Before doing that, you need to know the actual folder path.

1. The easiest way to copy the folder path is via File Explorer. So, open the File Explorer, go to the folder you want to hide, and open it. Next, click on the address bar, and you will see the folder path. To copy the path, right-click and select the “Copy” option.

Attrib command to hide folder 01

2. Once you have the folder path, search and open the command prompt window from the start menu. In Windows 11, you can open Windows Terminal and open Command Prompt from the top bar dropdown menu.

Command prompt regular

3. Now, execute the below command to hide the folder. Don’t forget to replace the dummy folder path with the actual folder path you copied earlier. To paste the copied folder path, right-click in the command prompt. Alternatively, you can also right-click on the Command Prompt title bar and select the “Edit -> Paste” option.

attrib +s + h "C:\folder\path\"
Attrib command to hide folder 02

4. As soon as you execute the command, the folder is hidden from plain sight.

Attrib command to hide folder 03

5. Even if you try to unhide the folder by selecting the “Hidden files” checkbox in the View tab, you can’t see it. You have to unhide it using the attrib command.

Attrib command to hide folder 04

6. To unhide the folder, you can use the same attrib command with a slight modification. All you have to do is replace “+” in the above command with “-.” Simply put, use the below attrib command to unhide the folder.

Attrib command to unhide folder:

attrib -s -h "C:\folder\path\"
Attrib command to hide folder 05

7. The folder will reappear in the file explorer upon successful execution.

Attrib command to hide folder 06

As you can see, it is nothing complicated, and the attrib command is quite helpful to hide any folder you want quickly.

Method #2 – Attrib CMD to Hide Folders With PowerShell

Since Windows 10 & 11 is furiously promoting PowerShell over the command prompt and considering how PowerShell supports almost all the Command Prompt commands, you can also use the same technique to hide folders in Windows 10 & 11. Let me show you how.

1. First, open the file explorer and go to the place where you’ve stored the folder you want to hide. For instance, my folder “WindowsLoop” is located at the root of the D drive. So, I opened the D drive, and as you can see, I have a folder named “WindowsLoop” in the root.

Attrib command to hide folder 07

2. Now, Shift + Right-click in the file explorer and select the “Open PowerShell here” option. This action will open the PowerShell in the same folder. This makes it so that you can use just the folder name rather than the full folder path in the PowerShell command. In Windows 11, select “Open in Windows Terminal.”

Attrib command to hide folder 08

3. In the PowerShell window, execute the below command. It will hide the folder instantly. Don’t forget to replace “Folder_Name” with the actual folder name. If the folder name has space(s) in it, wrap it in quotes like the below command. In Windows 11, type the full folder path.

attrib +s +h "Folder_Name"
Attrib command to hide folder 09

4. To unhide the folder, you can use this command.

attrib -s -h "Folder_Name"
Attrib command to hide folder 10

So, How Does the Attrib Command Hides the Folder?

There is no magic here. All we are doing is changing the folder attributes so that Windows thinks of it as a protected system folder. Protect system folders are hidden by default and cannot be unhidden in usual ways.

You see, when you use the Unhide option in the View tab, Windows won’t show the protected system folder. To see a protected system folder, you need to tell Windows to show it specifically. If you are curious, follow the below steps after hiding the folder using the above method to see the hidden protected system folder.

1. First, unhide the folder by selecting the “Hidden items” checkbox under the “View” tab. In Windows 11, select “View > Show > Hidden items.” Without doing this step first, you will not see the hidden protected system folder even if you follow the other two steps below.

Attrib command to hide folder 13

2. Next, click on the “Options” button in the same View tab. In Windows 11, click on the “Menu” (…) icon and then choose “Options.”

Attrib command to hide folder 14

3. This action will open the Folder Options window. Here, go to the “View” tab and uncheck the “Hide protected operating system files (Recommended)” option, and save changes by clicking on the “Ok” button.

Attrib command to hide folder 11

That is it. You should instantly see the hidden folder along with some other protected system folders like $Recycke.BIN, System Volume Information, etc. To reverse the change, select the “Hide protected operating system files (Recommended)” checkbox in step 3.

Attrib command to hide folder 12

Attrib Command to Hide Folder – Conclusion

As you can see, the attrib command is a pretty nifty command to quickly super hide folders from plain sight so that it won’t appear even if someone selects the “Hidden Items” option in the View tab. Unless a user knows how to see the protected system files or knows the exact folder path, you can be pretty sure that no one will ever see your hidden folder.

That being said, this is a poor and unsafe way to store/protect personal and sensitive information. It would be best to use proper tools like BitLocker or VeraCrypt to protect your sensitive information.

If you like this article, check out how to delete files with commands and how to format a USB drive with commands, and how to zoom in and zoom out in command prompt and PowerShell.

Scroll to Top