PowerShell will not automatically list the hash table, so you have to call the GetEnumerator() or Keys property. After that there are several options. First use the $OFS Ouptut Field Seperator. This string is used when the array is converted to a string. The default is "" , but you can change it:
$FileExtensions = @{".foo"=4;".bar"=5} $OFS =';' [string]($FileExtensions.GetEnumerator() | % { "$($_.Key)=$($_.Value)" })
Next, using the -join operator:
$FileExtensions = @{".foo"=4;".bar"=5} ($FileExtensions.GetEnumerator() | % { "$($_.Key)=$($_.Value)" }) -join ';'
source share