Attrib.exe is a Windows operating system file located in the C:\Windows\System32 folder. It allows you to display or change File Attributes. The function of the attrib command is to set, change or remove such file attributes Using the attrib command, you can make files read-only, archive, system and hidden.
What are File Attributes?
A File Attribute is a metadata that is associated with any file on your computer and describes or keeps track of information like when the file was created or modified, file size, file extensions, and file permissions.
The Windows operating system offers four attributes for files and folders. They are:
- Read-only – r : These are readable, but cannot be changed
- System – s : For use by the operating system and not normally displayed in a directory listing
- Hidden – h : They are not displayed in a directory listing by default
- Archive – a : For backing up or copying files
How to change File Attributes using attrib.exe
These attributes can be set using [+] or removed using [-] commands.
To see the file attributes, you have to right-click on the file or folder and select Properties. In Windows 11/10/8, Windows 7 or Windows Vista, you will see only the Read-only and Hidden check boxes. To see the Archive check box, you have to click Advanced.
If you wish to see the syntax for the Attrib command, type attrib /? at the command prompt and hit Enter.
To change the file attribute using the attrib command, you have to execute the command in the following format:
attrib [{+|-}r] [{+|-}a] [{+|-}s] [{+|-}h] [{+|-}i] <drive>:<path><filename>
For example, if you want to add the Read Only attribute to the file, the command is:
attrib +r "E:\Images\The Windows Club.png"
In the above command, +r is the parameter to add the Read Only attribute to the file and The Windows Club is the name of the image file. The complete path of the file along with its name should be in quotations. Also, note that you have to type the file extension along with the file name, otherwise the command will not work.
Create a super-hidden private file or folder
As a Windows end-user, we can use this feature to create a hidden private file or folder on our Windows computer. Let’s say you have a normal folder named Private on your desktop, and you want to make it hidden.
To do so, open a command prompt, and type the following in it and hit Enter. Here ACK is my Username, so make sure you use yours in its place.
attrib +s +h "C:\Users\ACK\Desktop\Private"
This will make the folder a ‘system’ folder AND a ‘hidden’ folder. However, if you use “-s +h” it will make the folder an ordinary hidden folder only.
To see it, you have to via Folder Options, check Show hidden files, folders, and drives and uncheck Hide protected operating system files. Or via CMD you can simply use “-s -h” instead of the above command.
Of course, this method is not fool-proof, but it’s good enough a way to keep your folders secret and hidden from most prying eyes. If you are looking for more, you can check out this free file and folder encryption software.
Make a list of all hidden system files and folders
In the rare eventuality that you forget the name of the folder, but know the location – or vice versa, you can run the following command.
attrib C:\*.* /s|find "A SH">C:\hiddensystemfiles.txt¬epad C:\hiddensystemfiles.txt
This will output the list of all hidden system folders on your C drive.
You can, of course, modify the syntax suitable to search for only select locations also.
File attribute changer freeware
If you are looking for a freeware tool to change file and folder attributes and properties quickly, you can check out Attribute Changer. It is a tool for power users to change all kind of file and folder attributes, date, time and even NTFS compression. Exif date and time information stored in digital images are also easily altered with Attribute Changer.
What does attrib +H +R +S do?
The command attrib is used to view or change file attributes. +H, +R, and +S are the parameters used in this command. +H adds the Hidden attribute to the file, +R adds the Read Only attribute to the file, and +S adds the System file attribute. If the file uses the System file attribute, you must clear the attribute before making any changes to the attributes for the file.
How do I change hidden files in attrib?
The parameter +/-h is used to add and remove the Hidden attribute to a file. If the file is already hidden, you have to use the -h parameter with the attrib command to remove the Hidden attribute. This will unhide the file. But if you want to hide a file, you have to use the +h parameter with the attrib command.
See how you can add File Attributes option to Context Menu.
Great article – well done, Anand!
A GREAT, GREAT tip. Tank you.
cmd says FIND: parameter format not correct
(in italian -> FIND: formato del parametro non corretto)
why?
if it shows parameter format not correct, the file maybe contains of spaces
For example : I want to make folder “WordPress coba” to be super hidden.
So in cmd, I must type the directory enclosed by quotes.
attrib +s +h “D:Wordpress coba”
If the folder or file name doesn’t consist of spaces, you can type the directory file/folder without quotes
attrib +s +h D:Games
It should work now :D
cmd says “file not found”
but the file name doesn’t contain any space and i type the location correctly…… :(
For those with formatting or file not found issues, right click your folder and MAKE SURE ITS UNHIDDEN AND NOT CHECKED AS READ ONLY. I had to do it five times before i figured out the problem.
Format should be as follows (for super hidden):
attrib +s +h “C:UsersUsernameDesktopFoldername”
How to hide photos and videos using cmd. I used folder method which uses attrib command to hide folders, It worked fine for hiding the folder but when I typed file extensions such as (.jpg) in the search box all the files were shown. how to hide them using cmd. Help me …….
I recently installed Windows 10. It’s been a disaster. All the files were marked read-only. I tried changing the attributes using your suggestion. Doesn’t work. I tried it in command prompt. No luck. I will have to return the laptop and go back to paper & pencil.