- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2019-08-13T21:07:52+09:00","default:ryuichi","ryuichi")
* Select-Objectで特定のプロパティを文字列で取得 [#p7e2abde]
*** dirで取得するのはFileInfoオブジェクト [#pe7528c6]
PS> dir *.txt | gm
TypeName: System.IO.FileInfo
*** FileInfoオブジェクトをパイプしてselectするとSelected.System.IO.FileInfoオブジェクト [#cd022213]
PS> dir *.txt | select FullName
FullName
--------
C:\tmp\1.txt
C:\tmp\2.txt
C:\tmp\3.txt
PS> dir *.txt | select FullName | gm
TypeName: Selected.System.IO.FileInfo
*** オブジェクトではなく文字列で取得するには-ExpandPropertyを使う [#o129e383]
PS> dir *.txt | select -ExpandProperty FullName
C:\tmp\1.txt
C:\tmp\2.txt
C:\tmp\3.txt
PS> dir *.txt | select -ExpandProperty FullName | gm
TypeName: System.String