how to use “if” statements inside pipeline
问题 I'm trying to use if inside a pipeline. I know that there is where (alias ? ) filter, but what if I want activate a filter only if a certain condition is satisfied? I mean, for example: get-something | ? {$_.someone -eq 'somespecific'} | format-table How to use if inside the pipeline to switch the filter on/off? Is it possible? Does it make sense? Thanks EDITED to clarify Without pipeline it would look like this: if($filter) { get-something | ? {$_.someone -eq 'somespecific'} } else { get