小编D. *_*ley的帖子

将变量的值作为键添加到HashTable

PowerShell V5 Windows 10

例如,变量$EmployeeID包含 string testValue,我想简单地使用$HastTable.Add()函数内部的前一个变量的值。它看起来像这样:

$HashTable.Add($EmployeeID, 'some_value')
Run Code Online (Sandbox Code Playgroud)

当然,这不起作用,但希望我清楚我想要实现的目标。

这样,我就可以像往常一样访问该值:

$var = $HashTable.testValue
Run Code Online (Sandbox Code Playgroud)

powershell hashtable powershell-5.0

5
推荐指数
1
解决办法
9470
查看次数

标签 统计

hashtable ×1

powershell ×1

powershell-5.0 ×1