The File Explorer in Windows 10 enables you to hide files and folders. To hide a file or folder, you need to right-click on the file/folder, click Properties and then select the Hidden option. The hidden file/folder won’t show up in the File Explorer as long as the Don’t show hidden files, folders, or drives option is turned on in the Folder Options.
In addition to the File Explorer, you can hide files and folders via the Command Prompt as well. You can use the Command Prompt in the event when the Folder Options is not opening or want to hide files and folders without booting into Windows 10.
Hide a file via Command Prompt in Windows 10
Here is how to hide files and folders via the Command Prompt in Windows 10.
IMPORTANT: When you hide a file or folder using either Command Prompt or File Explorer, the file/folder will be hidden until the Hide hidden files, folders, or drives option is selected in the Folder Options. Anyone who has access to your PC can change this setting to view hidden files and folders. Therefore, if you want to hide or protect crucial files or folders, we advise you to use third-party folder locker software.
Complete the given below instructions to hide files and folders via Command Prompt in Windows 10.
Step 1: Open the Command Prompt. No need to open it as administrator.
Step 2: At the Command Prompt window, type the following command:
attrib +h FileOrFolderPath
In the above command, replace the FileOrFolderPath with the actual path to the file or folder.
For instance, if the path to the file/folder is D:\Test, then, you need to type:
attrib +h D:\Test
Press the Enter key to execute the command.
Tip: To copy the file or folder path, open up the File Explorer and navigate to the location where the file or folder that you would like to hide is present. Hold down the Shift key, right-click on the file/folder and then click the Copy as path option to copy the file/folder path to the clipboard.
To show a hidden file or folder
Step 1: At the Command Prompt window, execute the following command:
attrib -s -h FileOrFolderPath
Hide drives using Command Prompt in Windows 10/8/7
Step 1: Type CMD in Start menu search area and hit Enter to launch Command Prompt. You can also find the Command Prompt under Accessories category in Start menu. In Windows 10 and 8.1, you can right-click on the Start button, and then click Command Prompt to open the same.
Step 2: In the Command Prompt, type Diskpart and hit enter key. Click Yes if you are prompted with UAC (User Account Control) dialog-box.
Step 3: And then type List Volume and hit enter to see list of all drives.
Step 4: Select the drive that you want to hide. To do this, type Select Volume G (here, G is the drive letter) or Select Volume 8 (here 8 is the volume number)
Step 5: To hide a drive, type Remove Letter G. Here, G is the drive letter than you want to hide.
Step 6: You are done. Close the Command Prompt.
Show hidden drives using Command Prompt in Windows 10/8/7
Step 1: Follow the procedure mentioned in step 1, 2, and 3 of Method 1.
Step 2: Select the volume number for which you want to assign a drive letter and show in the explorer. Type Select Volume 8 (here, 8 is the volume number) and hit Enter key.
Step 3: Once selected, type Assign Letter G and hit Enter key to see the drive in explorer(replace G with the drive letter that you have previously removed).