How to Hide Files and Folders Using Command Prompt

By
Ajoy Kumar
He is a prominent tech writer with over six years of experience and the founder of TheCoderWord. He delivers high-quality content revolving around troubleshooting and how-to...
5 Min Read
Disclosure: This site uses affiliate links. We may earn a commission at no extra cost to you. Thanks for your support!
How to Hide Files and Folders Using Command Prompt
Quick Tips
  • Hiding files using Command Prompt only changes their visibility; it does not encrypt or password-protect them.
  • Always double-check the file or folder name before running the attrib command to avoid hiding the wrong item.
  • If a hidden file doesn’t reappear, make sure the “Show hidden files” option is enabled in File Explorer settings.

With technology advancing rapidly, data privacy has become more important than ever. Many users rely on different methods to keep sensitive information secure, and on Windows, one simple yet effective approach is hiding files and folders using Command Prompt.

In this guide, we’ll explain how to hide and unhide files and folders on Windows using Command Prompt, in a clear and beginner-friendly way.

How to Hide Files and Folders Using Command Prompt

Windows is one of the most widely used operating systems for desktops and laptops. However, many users are still unaware of the powerful tools it offers, including Command Prompt.

Command Prompt is a built-in command-line interpreter in Windows. While it may look intimidating at first, it can perform several useful tasks, such as hiding and unhiding files and folders, without installing any third-party software.

Follow the steps below to hide files or folders on your Windows PC.

1. Go to the taskbar, search for Command Prompt, and click on the result to open it.

Open CMD

2. Navigate to the location of the file or folder you want to hide by typing the cd command and pressing Enter:

cd C:\Users\admin\Desktop\Files

Note

Replace the path after cd with the actual location of the file or folder you want to hide.

3. To hide a file or folder, type the following command and press Enter:

attrib +h "Secret Files" 
Hide Files and Folder Using Command Prompt

Replace “Secret Files” with the name of the file or folder you want to hide. Quotation marks are only required if the name contains spaces.

However, if you don’t know the file or folder name, you can use the dir command to view them.

Once the command is executed successfully, the selected file or folder will no longer be visible in File Explorer.

How to Hide All Files and Subfolders Inside a Folder

If you want to hide an entire folder along with everything inside it, follow these steps:

1. Open Command Prompt and navigate inside the folder by typing the cd command.

2. To hide all files and subfolders within that folder, type the following command and press Enter:

attrib +h /s /d
Hide All the File and Folders

Command Prompt will process all files and folders inside the directory. After completion, all items inside the folder will be hidden from File Explorer.

How to Unhide Files and Folders Using Command Prompt

You can remove the hidden attribute at any time by following these steps.

1. Open Command Prompt from the taskbar search.

2. Navigate to the location of the hidden file or folder using cd command:

cd C:\Users\admin\Desktop\Files 

Note

Update the path according to your file location.

3. Type the following command to unhide a file or folder and press Enter:

attrib -h "Secret Files"
Unhide Files using Command Prompt

The file or folder will become visible again in File Explorer.

How to Unhide All Files and Subfolders Inside a Folder

If you previously hid all files and subfolders within a folder, follow these steps to unhide them:

1. Open Command Prompt and move into the hidden folder loaction using cd command.

2. Remove the hidden attribute from all files and subfolders by typing:

attrib -h /s /d
Unhide All the Files

3. Wait for the command to finish processing. After that, all files and subfolders inside the folder will now be visible.

Final Thoughts

Using Command Prompt to hide or unhide files and folders on Windows is much simpler than it appears. Once you get comfortable with a few basic commands, it becomes a fast and efficient way to manage file visibility.

Just make sure you remember the file name and location before hiding anything. Otherwise, you may need to enable Show hidden files in File Explorer to locate it later.

Want to see more helpful guides like this? Add thecoderworld as your preferred source on Google so our content appears more often in your feed.

Share This Article
Follow:
He is a prominent tech writer with over six years of experience and the founder of TheCoderWord. He delivers high-quality content revolving around troubleshooting and how-to guides for Windows, Linux, macOS, Chrome, and more.
Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *