BHznJNs逆天 PowerShell 中发帖

最近在尝试实现一个面向 Agent 的 Shell 工具,今天实现得差不多了,遇到一个小 bug,排查后发现是一个 PowerShell 的小坑: 
比如对于这个脚本:
$a = ConvertFrom-Json '["abc"]'
Write-Host $a
Write-Host "Type of a: " + $a.GetType().Name

$b = ConvertFrom-Json '["abc", "def"]'
Write-Host $b
Write-Host "Type of b: " + $b.GetType().Name

我定义了两个变量 a 和 b,都是使用从一个 JSON 字符串解析得到的值,但是运行结果如下:
abc
Type of a: + String
abc def
Type of b: + Object[]

a 是一个字符串,而 b 是个数组...