Example Problem:You have a text file that contains key value pair and you want to use them as a hash table in powershell.
Values.txt:key1=value1key2=value2key3=value42
One way to do it:PS C:\temp> gc values.txt | %{$h = @{}} {if ($_ -match "(.*)=(.*)") {$h[$matches[1]]=$matches[2];}}
PS C:\temp> $h
Name Value ---- ----- key3 value42 key2 value2 key1 value1