如何比较Powershell中的两个对象引用是否相同(即标识/相同运算符)?
如何比较Powershell中的两个对象引用是否相同 我在找一个接线员如何比较Powershell中的两个对象引用是否相同(即标识/相同运算符)?,powershell,Powershell,如何比较Powershell中的两个对象引用是否相同 我在找一个接线员 $true <op> $true # is true $true <op> "true" # is false "true" <op> $true # is false 错误: [ERROR] Cannot convert value "True" to type "System.Type". Error: "Invalid cast from 'System.Boolean' to '
$true <op> $true # is true
$true <op> "true" # is false
"true" <op> $true # is false
错误:
[ERROR] Cannot convert value "True" to type "System.Type". Error: "Invalid cast from 'System.Boolean' to 'System.Type'."
[ERROR] At line:1 char:1
[ERROR] + $true -is $true
[ERROR] + ~~~~~~~~~~~~~~~
[ERROR] + CategoryInfo : NotSpecified: (:) [], RuntimeException
[ERROR] + FullyQualifiedErrorId : RuntimeException
[ERROR]
$true.Equals($true)
[System.Runtime.CompilerServices.RuntimeHelpers]::Equals($true,$true)
[ERROR] Cannot convert value "True" to type "System.Type". Error: "Invalid cast from 'System.Boolean' to 'System.Type'."
[ERROR] At line:1 char:1
[ERROR] + $true -is $true
[ERROR] + ~~~~~~~~~~~~~~~
[ERROR] + CategoryInfo : NotSpecified: (:) [], RuntimeException
[ERROR] + FullyQualifiedErrorId : RuntimeException
[ERROR]