How to hide files or folders in windows using command Line?
If you share your PC with others then you may want to hide some files and folders so people don’t check your personal data.
Hide Files or Folders Using the Command Line
A simple way to hide a file or folder is to change its attributes using the attrib command on the command line.
Suppose you want to hide the Sample.mp4 file
1.Open the Command Prompt by pressing Windows key + R to open the Run dialog box.
2.Type cmd.exe in the Open box and click on OK.
3.Type the following command
attrib C:\Users\me\Documents\ToHide\Sample.mp4 +s +h
The +s and +h are the attributes you’re setting for the file. The +s attribute is the System file attribute and indicates the file is for use by the operating system and is not normally displayed in a directory listing. The +h is the Hidden file attribute and indicates the file will not be displayed in a directory listing by default.
When you open the folder in File Explorer that contains the hidden file or folder, it will not be visible. Even going to View > Show/hide and checking the Hidden items box will not show the hidden file or folder.
To unhide a file or folder, use the same attrib command, replacing the “+” with “–” in front of the “s” and “h” attributes.
attrib C:\Users\me\Documents\ToHide\Sample.mp4 -s -h
Tech writer at newsandstory
Total 1027 views