Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Here is an example of creating a dictionary data structure in Powershell.
- $dict = @{
- Key1 = 'Value1';
- Key2 = 'Value2';
- Key3 = 'Value3'
- }
- # Access the Value of a Key
- $dict['Key1']
- # Add a Key-Value Pair
- $dict['Key4'] = 'Value4'
- # Remove a Key-Value Pair
- Remove-Item $dict['Key3']
- # Loop Through the Dictionary
- foreach ($value in $dict.Values) {
- Write-Output $value
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement