" When the value of the variable is an array, the += operator appends theIn the second part of the script below, I pump the results of a foreach loop into an explicitly typed compound assignment variable ("$RecurseList"):
values on the right side of the operator to the array. Unless the array is
explicitly typed by casting, you can append any type of value to the array..."
Historic Blog. No longer active. A script repository that stopped at Powershell 4.0 is at www.rmfdevelopment.com/PowerShell_Scripts . My historic blog (no longer active) on Network Security ( http://thinking-about-network-security.blogspot.com ) is also Powershell heavy. AS of 2/27/2014 all Scripts are PS 4.0.
Saturday, September 3, 2011
Compound variable assignment as [array[]] based storage
Below is a function I have written to demonstrate a function which recursively checks ownership and access for files modified within a given time span. What I call to your attention is the ability to use the assignment operator ('+=') to store data recursively as highlighted in salmon. This is mentioned in 'about_assignment_operators' in the help for Powershell V2:
Labels:
Compound Assignment;
Subscribe to:
Posts (Atom)