当我运行power shell脚本时,出现以下错误: 我的问题是为什么我会得到这样的错误? char:13是$ in $ results,这是我所说的返回值,为什么我得到一个“不能调用空值表达式”?
You cannot call a method on a null-valued expression.
At C:\test.ps1:79 char:13
+ $results = ($content -match "MyValues" -split "=")[1].Tr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull