attrib

Windows CMD · Files · available in the simulator

What it does

Displays or changes file and directory attributes. Attributes: a (archive), r (read-only), h (hidden), s (system).

Syntax

attrib [+r|-r] [+a|-a] [+s|-s] [+h|-h] [archivo] [/s] [/d]

Options and parameters

  • +r/-r

    sets/clears read-only attribute

  • +h/-h

    sets/clears hidden attribute

  • +s/-s

    sets/clears system attribute

  • +a/-a

    sets/clears archive attribute

  • /s

    applies to subdirectories

  • /d

    applies to directories as well

  • +R

    Sets the read-only attribute.

    attrib +r archivo.txt
  • -R

    Clears the read-only attribute.

  • +A

    Sets the archive file attribute.

  • -A

    Clears the archive file attribute.

  • +S

    Sets the system file attribute.

  • -S

    Clears the system file attribute.

  • +H

    Sets the hidden file attribute.

    attrib +h +s archivo.txt
  • -H

    Clears the hidden file attribute.

  • /S

    Applies the change to matching files in the current directory and all subdirectories.

  • /D

    Applies the change to directories as well.

  • /L

    Applies the operation to the symbolic link instead of its target.

Usage examples

  • attrib +r f1
  • attrib +h +s f2
  • attrib +r *.txt /s
  • attrib /d
  • attrib archivo.txt
  • attrib +h +s archivo.txt
  • attrib +r archivo.txt
Practise attrib

Related commands