Setting the mode and extended file and folder attributes

When you want to change the mode and the extended attributes of a file or folder, you need to access the extended property named Attributes. The Attributes property allows you to read and write to itself. This means that if you want to replace all of the file or folder attributes, you can just declare the new Attributes and set them to the Attributes property. Likewise, if you want to maintain the existing Attributes but want to add new Attributes, you declare a variable and call the existing Attributes property; then you add the new Attributes using a comma separator. You then set that new variable to the Attributes property of a file or folder.

To view and add a new extended file attribute, ...

Get Mastering Windows PowerShell Scripting now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.