Friday, April 27, 2012

ATTRIB - Dos Command :

It displays or changes file attributes to Read-Only, Archive, System File, Hidden File.
To view 'attrib' with its all possible parameters you can use following command. Its like help information to regarding that command.
attrib/?
You can check these file attributes as,
> Right Click on File.
> Properties
> You will see Attributes at the bottom of Properties information.
Commands can be run using Microsoft Windows XP Command Prompt (cmd.exe)
Syntax :
 ATTRIB [+R | -R]  [+A | -A]  [+S | -S]  [+H | -H] 
 [drive:][path][filename][/S [/D]]

where,

+ : Sets an attribute.
- : Clears an attribute.
R : Read-only file attribute.
A : Archive file attribute.
S : System file attribute.
H : Hidden file attribute.
[drive:][path][filename] : It specifies a file or files for attrib to process.
/S : It processes matching files in the current folder and all subfolders.
/D : It processes folders as well.

Use 1:

attrib +R D:\techno.txt
- It sets Read-only file attribute to techno.txt file.

Use 2:

attrib -R D:\techno.txt
It clears Read-only file attribute from techno.txt file.

Use 3:

attrib +A D:\techno.txt
It sets Archive file attribute to techno.txt file.

Use 4:

attrib -A D:\techno.txt
It clears Archive file attribute from techno.txt file.

Use 5:

attrib +S D:\techno.txt
It sets System file attribute to techno.txt file.

Use 6:

attrib -S D:\techno.txt
It clears System file attribute from techno.txt file.

Use 7:

attrib +H D:\techno.txt
It sets Hidden file attribute to techno.txt file.

Use 8:

attrib -H D:\techno.txt
It clears Hidden file attribute from techno.txt file.

Use 9:

attrib +H D:\test\*.txt /S
--- It sets Hidden file attribute to each file which have .txt file extension located in test folder.

Use 10:

attrib -H D:\test\*.txt /S
--- It clears Hidden file attribute from each file which have .txt file extension located in test folder.

Use 11:

attrib +H D:\test\*.txt /S /D
--- It sets Hidden file attribute to each file which have .txt file extension located in test folder also inside other folders.

Use 12:

attrib -H D:\test\*.txt /S /D
--- It clears Hidden file attribute from each file which have .txt file extension located in test folder also inside other folders.

Output :


Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

D:\DINESH > attrib +R D:\techno.txt

D:\DINESH > attrib -R D:\techno.txt

D:\DINESH > attrib +A D:\techno.txt

D:\DINESH > attrib -A D:\techno.txt

D:\DINESH > attrib +S D:\techno.txt

D:\DINESH > attrib -S D:\techno.txt

D:\DINESH > attrib +H D:\techno.txt

D:\DINESH > attrib -H D:\techno.txt

D:\DINESH > attrib +H D:\test\*.txt /S

D:\DINESH > attrib -H D:\test\*.txt /S

D:\DINESH > attrib +H D:\test\*.txt /S /D

D:\DINESH > attrib -H D:\test\*.txt /S /D

D:\DINESH > _

Properties : for Use 7:
file properties Fig.: Checking File Attributes Properties

No comments:

Post a Comment