我很难理解字符串值如何与 powershell 中的数组一起使用。我想知道将数组放入字符串的正确语法。目前,这就是我正在尝试的。方括号似乎被注册为字符串的一部分而不是变量。
$array = @(2,3,5) $string = " I have $array[2] apples"
这输出: I have 2 3 5[2] apples
I have 2 3 5[2] apples
arrays string powershell
arrays ×1
powershell ×1
string ×1