-- 前回調査してからちょっと間が空いたのと、前回なんとなく紆余曲折していたのでもう一度確認。 結局のところ「$myinvocation.ExpectingInput」を使うのがベスト? function test { [CmdletBinding(DefaultParameterSetName='NonPipeline')] param( [Parameter(ValueFromPipeline=$true)] $Data ) begin { $myinvocation.ExpectingInput } process {$myinvocation.ExpectingInput} end { $myinvocation.ExpectingInput } } "パイプライン" 1,2 | test "ダイレクト" test 1,2
![◆パイプライン中の処理かどうかを判定する](https://cdn-ak-scissors.b.st-hatena.com/image/square/a34d5cc006f69787f98aba138fdd102e53f3c131/height=288;version=1;width=512/http%3A%2F%2Flh3.ggpht.com%2F-PvqOFqjrdmY%2FT2FIYcl0PuI%2FAAAAAAAADeI%2FHLdJzAOGiUU%2Fw1200-h630-p-k-no-nu%2FScreenshot%2525255B45%2525255D.png%3Fimgmax%3D800)