How To Be Mastering Command Prompt #4 ATTRIB


ATTRIB is a command in cmd.exe (command prompt) to display or modifies file attributes

Here's the formula for use DIR:

ATTRIB [+R | -R] [+A | -A ] [+S | -S] [+H | -H]  [drive:][path][filename] [/S [/D

  +   Sets an attribute.
  -   Clears an attribute.
  Read-only file attribute.
  A    Archive file attribute.
   S    System file attribute.
   H    Hidden file attribute.
 

  Specifies a file or files for attrib to process
  /S  Processes matching files in the current folder and all subfolders.
  /D  Processes folders.

For example to use ATTRIB with assume the current directory is D:\ and there is a file with name abc.txt

1. Set file from hidden to non hidder -> attrib –h *
2. Set file from system to non system -> attrib –s *
3. Set a file with attributes from system and hidden file to non system and non hidden file -> attrib –s –h *
4. Set a file with non system and non hidden file to system and hidden file -> attrib +s +h *
Picture 1. Use ATTRIB

If you want to display or modify file attributes for all of files in current directory so you can type like attrib –s –h * or attrib +s +h *.txt, etc. If you want to display or modify a file or files in another directory, please type destination directory like this: attrib –s C:\Windows\*.exe

Just that, I hope this tutorial is usefull for you. Thank for your visiting. Please type your comments for this tutorial..



No comments:

Post a Comment