CMD attrib Command explanation

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.