Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PowerShell列表考虑计数中的[和]_Powershell - Fatal编程技术网

PowerShell列表考虑计数中的[和]

PowerShell列表考虑计数中的[和],powershell,Powershell,在PowerShell中,我有这样的列表[“a”,“b”],这是API的结果。当我检查计数时,它是4(不是2),因为它包含[和] 有什么办法处理这个问题吗?我只需要2个计数,在我看来像Json,因此简单的解决方案是将其转换为Powershell对象,如下所示: (ConvertFrom-Json '["a", "b"]').Count [“a”,“b”]不是有效的PowerShell语法,不管它是什么,它都不是PowerShell列表。您需要提供更多详细信息。

在PowerShell中,我有这样的列表
[“a”,“b”]
,这是API的结果。当我检查计数时,它是4(不是2),因为它包含[和]


有什么办法处理这个问题吗?我只需要2个计数

,在我看来像Json,因此简单的解决方案是将其转换为Powershell对象,如下所示:

(ConvertFrom-Json '["a", "b"]').Count
[“a”,“b”]
不是有效的PowerShell语法,不管它是什么,它都不是PowerShell列表。您需要提供更多详细信息。