The main instructions are how to use the attrib command to set the file read-only, hidden properties.
Attrib.exe is a small program under CMD that can be used to set the basic properties of a file (read-only, hidden, system, archive, and no content index).
Let's start by looking at what parameters it has.
C:\users\administrator>help attrib Display or change file properties. ATTRIB [+r |-r] [+a |-A] [+s |-S] [+h |-h] [+i |-i] [drive:][path][filename] [/S [/d] [/l]] + set properties. -Clears the attribute. R read-only file properties. A Archive File property. S System file properties. H hidden file properties. I have no content index file properties. [Drive:][path][filename] Specifies the file to be processed by the attrib. /S handles matching files in the current folder and all its subfolders. / D also handles folders. /L handles the properties of symbolic links and symbolic link destinations.
Then we use the example to verify the details.
The first step is to create a file first: D:\2.txt
Step Two , add a hidden property and a read-only property for the D:\2.txt file.
C:\users\administrator>attrib +r +h D:\2.txt
After you set the file properties successfully, there is no prompt.
The third step shows the file attributes of the d:\2.txt.
C:\users\administrator>attrib D:\2.txtA HR D:\2.txt
You can see that there are three properties in the current file, archive (A), Hidden (H), R (read-only). You might want to ask, why is there an archive (A) attribute? I'm not sure about that, but it's estimated that the archive (a) attribute is available by default when using the Create file.
CMD attrib Command explanation