这个 powershell 代码怎么可能因“无法索引到空数组。”而失败?这对我来说毫无意义。当然 $cloudPfx 应该是一个非空数组?
$cloudPfx = @( "Foo.pfx", "Bar.pfx", $SSLCertFileName )
$cloudPfx | foreach {
## call some function...
Save-Pfx "Foo\$_" (Join-Path $SomePath "Bar$_")
}
foreach : Cannot index into a null array.
At [that line]
+ $cloudPfx | foreach {
+ ~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [ForEach-Object], RuntimeException
+ FullyQualifiedErrorId : NullArray,Microsoft.PowerShell.Commands.ForEachObjectCommand