These don't work, but it would be nice if they did:
PS C:\> 'test.txt', '', 'example.xml' | where -match 'txt'
where-object : The specified operator requires both the -Property and -Value parameters.
PS C:\> 1..10 | ? -gt $x
?: The specified operator requires both the -Property and -Value parameters.
but integers and strings have no -Property way to access their values. Select-String helps for text, but outputs MatchInfo not String. And doesn't help for any of the operators except -match.
Used without -Property it could implicitly use $_ with whatever casting that implies, the same as if you'd written { $_ -operator 'value' } as the filterscript.
And then you could do:
PS C:\> 'test.txt', '', 'example.xml' | ? | foreach { .. }
and that would implicitly act like ? { $_ } which does a boolean cast on the object and passes true ones.
These don't work, but it would be nice if they did:
but integers and strings have no -Property way to access their values. Select-String helps for text, but outputs MatchInfo not String. And doesn't help for any of the operators except -match.
Used without -Property it could implicitly use
$_with whatever casting that implies, the same as if you'd written{ $_ -operator 'value' }as the filterscript.And then you could do:
and that would implicitly act like
? { $_ }which does a boolean cast on the object and passes true ones.