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 the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.