Windows 10: Hide or Unhide Folders / Files Using Command Prompt

April 11th, 2019 by Admin Leave a reply »

Is there a way to hide important files to prevent accidental deletion? In this tutorial we’ll show you how to hide or unhide folders / files in Windows 10 using Command Prompt.

Hide Folders or Files

When you’re going to hide a specific folder or file, open up the Command Prompt and type:
attrib +h "your_folder_or_file"

This command will assign the “Hidden” attribute to your target folder or file, and make it disappear from the File Explorer view.

If you need to hide all files and subfolders in your target location (for exmaple, D:\demo), run this following command:
attrib +h "d:\demo\*" /s /d

List Hidden Files

If you need to list hidden files and folders while in Command Prompt, use the CD command to change your working directory and then type:

dir /a:h

This will show all hidden folders or files in that location.

Unhide Folders or Files

When you need to unhide a specific folder or file, execute this command:
attrib -s -h "your_hidden_folder_or_file"

In order to unhide all hidden files and subfolders under a location (e.g. D:\demo), type this command:
attrib -s -h "d:\demo\*" /s /d

That’s it! The built-in option to hide folders/files is pretty easy but it’s not secure because anyone can unhide them the easy way. If you need to hide sensitive files from prying eyes, it’s a good idea to use third-party softwares (for instance, Protect My Folders) to hide and lock your folders/files with a password.