The command prompt window in Windows can be used to hide or unhide folders using the attrib command. This is a very useful command for completely hiding a folder. By using it, we can make the folder invisible when we set all folders and files to display. This can be helpful for protecting our software programs and important documents from unauthorized access. In this guide, we will share how to use the attrib command to hide or unhide folders in Windows.

Using Command Prompt, you can hide files and folders

  • The first step is to open the Command Prompt (CMD) by pressing the Win key.
  • Then, you will see the Start menu appear. Type CMD in the search bar and select the Command Prompt search result.
  • To hide a file, open the folder where the file is located. Then, select the address bar of the folder and type CMD, and hit the Enter button.
  • Alternatively, you can right-click on the folder and click “Open in Terminal (PowerShell).

For Hide File

attrib +h /s /d Secretfile.extension

Replace “Secretfile.extension” with the name of your hidden folder or file, including the appropriate extension (e.g., .txt, .jpg, .pdf, etc.). It is only necessary to use quotation marks when the name of the folder or file contains spaces.

For Hide Folder

You can hide a particular folder or file by opening the Command Prompt and typing the following command:

attrib +h /s /d "Secretfile"

Replace ‘SecretFiles’ with the name of your hidden folder. It is only necessary to use quotation marks when the name of the folder contains spaces.

Example:

We need to hide a text file.

To View Hide Files

To view the secret files, enter the following code in the Command Prompt and press the Enter key: “attrib +h ‘Secret Files'”. “Secret Files” should be replaced with the name of the file you wish to hide. Quotation marks are only needed if the file name contains a space.

How to Unhide Files and Folder

  • The first step is to open the Command Prompt (CMD) by pressing the Win key.
  • Then, you will see the Start menu appear. Type CMD in the search bar and select the Command Prompt search result.
  • To unhide a file, open the folder where the file is located. Then, select the address bar of the folder and type CMD, and hit the Enter button.
  • Alternatively, you can right-click on the folder and click “Open in Terminal (PowerShell).”

For Unhide File

attrib -h /s /d Secretfile.extension

Replace “Secretfile.extension” with the name of your hidden folder or file, including the appropriate extension (e.g., .txt, .jpg, .pdf, etc.). It is only necessary to use quotation marks when the name of the folder or file contains spaces.

For Unhide Folder

attrib -h /s /d "Secret file"

Replace “(SecretFiles)” with the name of your hidden folder or file. It is only necessary to use quotation marks when the name of the folder or file contains spaces. Hopefully, you have successfully used CMD to securely hide folders in Windows 7, 10, and 11. Thank you for being with us.