![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| XP | Variable and deepcopy Hello, this code does not copy the fields Options and Attributes : Code: $SMA="System.Management.Automation" $MyArray=@(2,4) $Count=New-object "$SMA.ValidateCountAttribute" 1,3 (Get-Variable MyArray).Attributes.add($Count) $Range=New-object "$SMA.ValidateRangeAttribute" 2,7 (Get-Variable MyArray).Attributes.add($Range) (Get-Variable MyArray).Options=[System.Management.Automation.ScopedItemOptions]"Allscope" Copy-Item -Path variable:MyArray -Destination variable:MyArray2 gv MyArray|fl * gv MyArray2|fl * Thanks. |
My System Specs![]() |
| | #2 (permalink) |
| XP | Re: Variable and deepcopy For informations. About attribute (US) : http://www.manning.com/payette/wpia_errata.pdf About attribute (French) ftp://ftp-developpez.com/laurent-dardenne/articles/Windows/PowerShell/VariablesContraintes/fichiers/Les-variables-contraintes-sous-PowerShell.pdf "Deepcopy" : gv V|Export-Clixml Variable-V.xml $V2=Import-Clixml Variable-V.xml $V2.name= "V2" $v|gm $V2|gm Attention : The type of V is Int32 and the type of V2 is PsVariable. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| $Variable Is In {1,2,3,4} | PowerShell | |||
| Import-CSV from Web/Variable | PowerShell | |||
| Set-Variable | PowerShell | |||
| tab and variable | PowerShell | |||
| How can I ensure that a variable is a built-in powershell variable? | PowerShell | |||