Page 1 of 1

Introduction To File/Folder Attributes Introduction to file & folder attributes in Windows Rate Topic: -----

#1 Core  Icon User is offline

  • using System.Linq;
  • member icon

Reputation: 774
  • View blog
  • Posts: 5,097
  • Joined: 08-December 08

Post icon  Posted 31 July 2009 - 06:18 AM

All files and folders in Windows have attributes. Some of those are being set automatically (either by the operating system or by the program that accesses the specified resource) while others are being set by the user.

So what these attributes do? File/folder attributes set the folder accessibility options for example, specific attributes can determine whether a folder is read-only, hidden or is a system element. Many of these attributes are already set for the vast majority of folders on your PC, however, you can also set those manually, whenever you need to apply those.

In Windows, there are 5 types of file/folder attributes that can be set up. Those are:
  • R Shows whether the file/folder is read-only.
  • A Shows whether the file/folder is archive.
  • S Shows whether the file/folder is a system element that cannot be modified by other users.
  • I Shows whether the file/folder is not content indexed.
  • H Shows whether the file/folder is hidden.

All these attributes can be easily set and removed from any folder on a Windows machine. How can you do this? By using the system console (command prompt).

Either go to Start > All Programs > Accessories > Command Prompt or just launch the Run dialog , type cmd and press Enter.

Now that you launched the system console, you can access the attrib command. This is the command used to set or remove file/folder attributes. Its syntax is the following:

attrib [ [ + | - ] attribute] [path][advanced options]

You already know the attribute types that can be set to a specific file or folder, so I am going to explain the rest of the elements.

The [ + | - ] element shows whether an attribute is being assigned or removed. For example, if I want to set the Hidden attribute to a file, I will use the +H parameter. To remove the attribute, I will use -H. This applies to every single attribute.

The [path] element stands for the file/folder path, that is being subject to manual attribute change. For example, it could be something like C:\MyFolder\MyFile.txt or it could be like MyFile.txt if the file is in the currently active (selected in the console) folder.

The [advanced options] part denotes whether there are advanced options attached to the command. These options could be:
  • /S Processes all matching files in the current folder.
  • /D Will process folders as well.
  • /L - Work on the attributes of the Symbolic Link versus the target of the Symbolic Link.

On a side note, a Symbolic Link is a file that is interpreted by the operating system as a path to another file or folder (in fact, it contains the reference to that specific file or folder).

Also, you can set multiple attributes in a single command. For example, the syntax of the following command is absolutely valid:

attrib H +S +R A +I MyFile.txt

You might also want to skip some attributes. Therefore, this statement is also valid;
attrib H +S +I MyFile.txt

When setting attributes, you can write the assigning and removing operators with the attribute type in any order. For example this statement:

attrib H +S +I MyFile.txt

Will do the same as this one:

attrib +I +S -H MyFile.txt

What is the practical use of manually setting the attributes? From my own experience I can say that setting attributes manually is a way to ensure better protection for your system. You can set specific folders to be hidden or system, while at the same time you can remove these attributes from malicious files.

Have you ever had the problem when you cannot delete a file but you surely know that this one file is malware? This is most likely caused by an automatically set attribute that prevents this. Manually removing the specified attribute comes handy in such situations, as most malicious files are protected from basic deletion and modification.

Is This A Good Question/Topic? 0
  • +

Replies To: Introduction To File/Folder Attributes

#2 Nameless1  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 16-July 09

Posted 01 August 2009 - 04:35 AM

well done :)
Was This Post Helpful? 0
  • +
  • -

#3 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Posted 01 August 2009 - 05:03 AM

Nice Tutorial Core: :^:
so lets make it executable no need for code more than one time:
i coded for removing Autorun anti virus.

just open notepad and past this code save it as name.bat (select Save as type=All)
C:
cd..
cd..
attrib -a -r -h -s autorun.inf
del autorun.inf
D:
cd..
cd..
attrib -a -r -h -s autorun.inf
del autorun.inf
E:
cd..
cd..


and use any where.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1