This article introduces a Attrib.exe applet under CMD, which can be used to set the properties of a file. We know that the properties of the file are read-only, hidden, system, archive and no content index, etc. 5, read-only and hidden use more, the other three are used relatively little.
I do not know if you have used attrib.exe this cmd applet, it can be used to set the properties of the file. Take a look at its help file first.
Copy Code code as follows:
C:\users\splaybow>help attrib
Displays or changes the file properties.
ATTRIB [+r |-r] [+a |-A] [+s |-S] [+h |-h] [+i |-i]
[Drive:] [Path] [FileName] [/S [/d] [/l]]
+ Set properties.
-Clears the properties.
R read-only file properties.
A Archive file attribute.
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 attrib.
/S handles matching files in the current folder and all of its subfolders.
/d also processes folders.
/l handles attributes for symbolic links and symbolic link destinations.
Let's use an example to see how to use attrib to set the properties of a file.
The first step is to use the echo command to create a file: D:\2.txt
Copy Code code as follows:
C:\users\splaybow>echo Xxxx>d:\2.txt
After the file is created, there will be no prompts.
The second step is to add a hidden attribute and a read-only property to the D:\2.txt file.
Copy Code code as follows:
C:\users\splaybow>attrib +r +h D:\2.txt
When you set the file properties successfully, there will be no prompts.
The third step is to display the D:\2.txt file attributes.
Copy Code code as follows:
C:\users\splaybow>attrib D:\2.txt
A HR D:\2.txt
We can see that there are archive (A), Hidden (H), R (read-only) three properties in the current file. Here you may want to ask, why is there an archive (a) attribute? This Hongo also explains that it is estimated that when you create a file using Echo, the file already has an archive (A) attribute.
In the fourth step , I'll take a look at the effects of archiving, hiding, read-only, system, no content index five attributes.
Copy Code code as follows:
C:\users\splaybow>attrib +a +s +r +i +h
When you set file properties successfully, there is no hint.
Step Fifth , look at the final file properties
Copy Code code as follows:
C:\users\splaybow>attrib D:\2.txt
A SHR I D:\2.txt
So see, five attributes all went up.
Finally, Hongo summarized the following points:
1. If you want to add attributes to the file using the syntax format "attrib + Mark 1 + Mark 2 ... < file path and name >".
2, if you want to remove some properties of the file, the 1th of the plus (+) in the minus sign (-) can be.
3. If you want to see which of the five attributes of the current file is archived, hidden, read-only, system, no content index, you can use the syntax format "attrib < file path and name >".
4. What is the meaning of these attributes? Hiding is hidden, but it can be seen with a hidden switch. After adding the system properties, the display is not visible, you must display the system files to see. Read-only representatives cannot modify and delete, but some commands can force deletion or modification of read-only files.
5, the following three instructions, if the file has both system properties and hidden properties, if you want to remove one of them, you must both be removed at the same time.
Copy Code code as follows:
PS c:\users\splaybow> attrib-h D:\2.txt
System File not reset-D:\2.txt
PS c:\users\splaybow> attrib-s D:\2.txt
Hidden file not Reset-D:\2.txt
PS c:\users\splaybow> attrib-s-H d:\2.txt
About the use of attrib settings file read-only, hidden and system properties, this article on the introduction of so many, I hope to help you, thank you!