Home  >  Article  >  System Tutorial  >  How to use attrib command

How to use attrib command

小老鼠
小老鼠Original
2024-04-18 17:45:26654browse

The Attrib command is used to operate the attributes of a file or directory, including setting or clearing read-only, archive, system, hidden, indexed, offline, and temporary attributes. Usage is as follows: display file attributes: attrib file name set file attributes: attrib [ |-] option [file name] clear file attributes: attrib - option [file name]

How to use attrib command

Attrib command usage

The Attrib command is used to display or change the attributes of a file or directory.

Syntax:

<code>attrib [+R|-R] [+A|-A] [+S|-S] [+H|-H] [+I|-I] [+O|-O] [+X|-X] [文件名]</code>

Options:

##-AClear archive attributes SSet system properties-SClear system properties HSet hidden attributes-HClear hidden attributes ISet index properties-IClear index properties OSet offline attributes-OClear offline attributes XSet temporary Properties-XClear temporary properties
Options Description
R Set read-only attribute
-R Clear read-only attributes
A Set archive attributes
##Usage:

    Display file properties:
  1. <code>attrib 文件名</code>
  2. For example:
<code>attrib test.txt</code>

    Set file properties:
  1. <code>attrib [+|-] 选项 [文件名]</code>
  2. For example:
<code>attrib +R test.txt</code>

This will set the read-only attribute of the test.txt file.

    Clear file attributes:
  1. <code>attrib - 选项 [文件名]</code>
  2. For example:
<code>attrib -R test.txt</code>

This will clear the read-only attribute of the test.txt file.

Note:

You must run Command Prompt as an administrator to change file attributes.
  • Some properties are not available for certain file types.
  • Be careful when using the attrib command as incorrect settings may result in inaccessible files or loss of data.

The above is the detailed content of How to use attrib command. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn