Draft for Information Only
Content
MS DOS Command: ATTRIB
MS DOS Command: ATTRIBReference from Microsoft MS-DOS cmd help DescriptionDisplays or changes file attributes. This command displays, sets, or removes the Read-Only, Archive, System, and Hidden attributes assigned to files or directories. SyntaxATTRIB [+R|-R] [+A|-A] [+S|-S] [+H|-H][[drive:][path]filename] [/S] To display all attributes of all files in the current directory, use the following syntax: ATTRIB Parameters
Switches
Related CommandFor more information about copying files and directories with different attributes, see the XCOPY command. RemarksCombining the Hidden and System attributesIf a file has both the Hidden and System attributes set, you can clear both attributes only with a single ATTRIB command. For example, to clear the Hidden and System attributes for the RECORD.TXT file, you would type: ATTRIB -S -H RECORD.TXT Using ATTRIB with groups of filesYou can use wildcards (? and *) with the filename parameter to display or change the attributes for a group of files. If a file has the System or Hidden attribute set, you must clear that attribute before you can change any other attributes for that file. Changing the attributes for a directoryYou can display or change the attributes for a directory. To use ATTRIB with a directory, you must explicitly specify the directory name; you cannot use wildcards to work with directories. For example, to hide the directory C:\SECRET, you would type the following: ATTRIB +H C:\SECRET The following command would affect only files, not directories: ATTRIB +H C:*.* Viewing archive attributesThe Archive attribute (a) is used to mark files that have changed since they were previously backed up. The MSBACKUP, RESTORE, and XCOPY commands use these Archive attributes. For information about Archive attributes, see the MSBACKUP, RESTORE, and XCOPY commands. ExamplesTo display the attributes of a file named NEWS86 located on the current drive, type the following command: attrib news86 To assign the Read-Only attribute to the file REPORT.TXT, type the following command: attrib +r report.txt To remove the Read-Only attribute from files in the \PUBLIC\JONES directory on a disk in drive B and from files in any subdirectories of \PUBLIC\JONES, type the following command: attrib -r b:\public\jones\*.* /s As a final example, suppose you want to give an associate a disk containing all files in the default directory on a disk in drive A except files with the .BAK extension. Because you can use XCOPY to copy only those files marked with the Archive attribute, you need to set the Archive attribute for those files you want to copy. To do this, you would use the following two commands to set the Archive attribute for all files on drive A and then to clear the attribute for those files with the .BAK extension: attrib +a a:*.* attrib -a a:*.bak Next, use the XCOPY command to copy the files from the disk in drive A to the disk in drive B. The /A switch in the following command causes XCOPY to copy only those files marked with the Archive attribute: xcopy a: b: /a If you want XCOPY to clear each file's Archive attribute after it copies the file, use the /M switch instead of /A, as in the following example: xcopy a: b: /m ©sideway ID: 110700130 Last Updated: 7/21/2011 Revision: 0 Latest Updated Links
![]() ![]() ![]() ![]() ![]() |
![]() Home 5 Business Management HBR 3 Information Recreation Hobbies 8 Culture Chinese 1097 English 339 Travel 18 Reference 79 Computer Hardware 254 Software Application 213 Digitization 37 Latex 52 Manim 205 KB 1 Numeric 19 Programming Web 289 Unicode 504 HTML 66 CSS 65 SVG 46 ASP.NET 270 OS 431 DeskTop 7 Python 72 Knowledge Mathematics Formulas 8 Set 1 Logic 1 Algebra 84 Number Theory 206 Trigonometry 31 Geometry 34 Calculus 67 Engineering Tables 8 Mechanical Rigid Bodies Statics 92 Dynamics 37 Fluid 5 Control Acoustics 19 Natural Sciences Matter 1 Electric 27 Biology 1 |
Copyright © 2000-2025 Sideway . All rights reserved Disclaimers last modified on 06 September 2019