所用语法的说明

Clarification of syntax used

谁能给我解释一下这个语法?我认为它不起作用,所以如果你能帮我找到另一种语法。

$fichesAEnvoyer = @($fiches | where {($_.TypeFiche -eq '2') -and (($_.Causes -eq '') -or ($_.Causes -eq $null) -or ($_.Causes.Count -eq 0) -or ($_.ActionCorrective -eq '') -or ($_.ActionCorrective -eq $null) -or ($_.DateActionCorrective -eq '') -or ($_.DateActionCorrective -eq $null) -or ($_.ActionPreventive -eq '') -or ($_.ActionPreventive -eq $null) -or ($_.DateActionPreventive -eq '') -or ($_.DateActionPreventive -eq $null) )})

我不明白为什么有$_而不是$fiches

$_where cmdlet 创建的一个变量,用于表示管道中的当前对象。例如,如果您这样做:

1,2,3 | where {$_ -ge 2} | Write-Host

然后$_将被设置为1,然后是2,然后是3。