2021/01/30 #Out-GridView と -PassThruパラメータ

皆様おはようございます、

#猫でもできるPowerShell(備忘録)

#Out-GridView と -PassThruパラメータ

 

<#元ネタ

Out-GridView

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/out-gridview?view=powershell-7.1#example-7--pass-multiple-items-through--out-gridview-

#>

 

Example 7: Pass multiple items through `Out-GridView`

This example lets you select multiple processes from the Out-GridView

window. The processes that you select are passed to the Export-Csv

command and written to the ProcessLog.csv file.

 

Get-Process | Out-GridView -PassThru | Export-Csv -Path .\ProcessLog.csv

 

The PassThru parameter of Out-GridView lets you send multiple items

down the pipeline. The PassThru parameter is equivalent to using the

Multiple value of the OutputMode parameter.

 

 

OGV(Out-GridView) のパラメータに

-PassThru

あるいは、

-OutputMode:Multiple

 

を使う事で複数の値をパイプラインに渡す、という事のようです

 

OGV | Tee-Object $v だといったん別の変数($v) に渡して扱う形ですが、

OGV -PassThru は文字通り一気通貫に扱うイメージですね

ではまた;