1
我試圖將冒號分隔字符串轉換爲PowerShell字典。以下是字符串。將冒號分隔字符串轉換爲PowerShell字典
$inputkeyvalues = "Appsetting:true|environment:prod"
我在$inputkeyvalues
可變兩個關鍵值對的和那些由管分隔符隔開。 第一個是:Appsetting:true 第二個是:環境:prod
我試圖轉換爲PowerShell字典。最終的輸出應該是這樣的,
Key Value
----- -----
Appsetting true
environment prod
$Dictionary= New-Object "System.Collections.Generic.Dictionary``2[System.String,System.String]"
可有人請建議我爲這個可能的解決方案。提前致謝。
太謝謝你了。它按預期工作。 – mahesh