Search

Where-Object simplified Syntax doesn't support multiple expressions by BigJimSlade80465

Active

1
0
Sign in
to vote
Type: Suggestion
ID: 776728
Opened: 1/16/2013 11:03:11 AM
Access Restriction: Public
0
Workaround(s)
When using the simplified syntax introduced in V3:

Works:
Get-ChildItem | where { !$_.PSIsContainer -and $_.Attributes -notmatch "Archive" }

Does not work:
Get-ChildItem | where {PSIsContainer -and Attributes -notmatch "Archive"}

Even better:
Get-ChildItem | where PSIsContainer -and Attributes -notmatch "Archive"
Details (expand)
How often does this happen?
Always Happens
Have you seen this problem before in this product?
Yes, this happens in all previous versions
Reproduction Steps
When using the simplified syntax introduced in V3:

Works:
Get-ChildItem | where { !$_.PSIsContainer -and $_.Attributes -notmatch "Archive" }

Does not work:
Get-ChildItem | where {PSIsContainer -and Attributes -notmatch "Archive"}

Even better:
Get-ChildItem | where PSIsContainer -and Attributes -notmatch "Archive"
Expected Results
All three expressions should yield equivlent results
File Attachments
0 attachments
Sign in to post a comment.
Sign in to post a workaround.