Difference between revisions of "Arrays (PowerShell)"

Jump to navigation Jump to search
156 bytes added ,  14:28, 17 December 2013
m
→‎Hashtables: Added loop
(Initial creation - content from Variables page)
 
m (→‎Hashtables: Added loop)
 
Line 86: Line 86:
$hash["Name"] = "Value"                              # Add value to end of array
$hash["Name"] = "Value"                              # Add value to end of array
$hash.GetEnumerator() | Sort-Object -Property Name  # Sort hashtable
$hash.GetEnumerator() | Sort-Object -Property Name  # Sort hashtable
</source>
To loop through a hash table
<source lang="powershell">
$hash.Keys | % {
    Write-Host "key = $_"
    Write-Host "value = " + $hash.Item($_)
}
</source>
</source>


[[category:PowerShell]]
[[category:PowerShell]]
[[category:Variables (PowerShell)]]
[[category:Variables (PowerShell)]]

Navigation menu