powershell代码段同时等于true和false

powershell代码段同时等于true和false,powershell,if-statement,boolean,Powershell,If Statement,Boolean,以下脚本: Foreach($keyword in $Nagios."Row Labels"){ if( -Not($Rt.SubjectLine | ?{$_ -match $keyword})){ "$keyword is not there" } } 匹配$Rt.Subjectline的所有内容的true 但这一个返回完全相同的结果!: Foreach($keyword in $Nagios."Row Labels"){ if($Rt.SubjectLin

以下脚本:

Foreach($keyword in $Nagios."Row Labels"){
    if( -Not($Rt.SubjectLine | ?{$_ -match $keyword})){
    "$keyword is not there"
    }
}
匹配$Rt.Subjectline的所有内容的true

但这一个返回完全相同的结果!:

Foreach($keyword in $Nagios."Row Labels"){
    if($Rt.SubjectLine | ?{$_ -match $keyword})){
    "$keyword is there"
    }
}
所以我的关键词都在那里…而且不是吗??? 那没有道理。。。我做错了什么

基本上我有一个数组,它包含简单的关键字,比如a=(“一”、“二”、“三”) 我只想检查这些词是否与$b的值匹配。。。。 看起来很简单,但是powershell说if语句是真是假

我做错了什么


非常感谢

忘了这个问题吧,我脑子里放了个屁。我用来比较的字符串不是我期望的