PowerShell - Hashes

Everything you wanted to know but were afraid to ask

Literals

Delimited lists

$hash = @{ foo = "bar"; bar = "baz" }
# Result ...
Name                           Value
----                           -----
bar                            baz
foo                            bar
# ... Result

Multi-line. No need for the ; anymore.

$hash = @{
  foo = "bar"
  bar = "baz"
}
# Result ...
Name                           Value
----                           -----
bar                            baz
foo                            bar
# ... Result

Using the ; is still fine though

$hash = @{
  foo = "bar";
  bar = "baz"
}
# Result ...
Name                           Value
----                           -----
bar                            baz
foo                            bar
# ... Result