【发布时间】:2021-02-28 21:33:04
【问题描述】:
我正在尝试在 PowerShell 中设置哈希表(字典)。当我尝试这条线时:
$users = @{abertram = 'Adam Bertram' raquelcer = 'Raquel Cerillo' zheng21 = 'Justin Zheng'}
我收到以下错误:
At line:1 char:38
+ $users = @{abertram = 'Adam Bertram' raquelcer = 'Raquel Cerillo' zhe ...
+ ~~~~~~~~~
Unexpected token 'raquelcer' in expression or statement.
At line:1 char:37
+ $users = @{abertram = 'Adam Bertram' raquelcer = 'Raquel Cerillo' zhe ...
+ ~
The hash literal was incomplete.
At line:1 char:91
+ ... 'Adam Bertram' raquelcer = 'Raquel Cerillo' zheng21 = 'Justin Zheng'}
+ ~
Unexpected token '}' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
为什么我会得到这个以及如何在 PowerShell 中正确设置哈希表?
【问题讨论】:
标签: powershell hashtable