Projecting an enumeration allows you to extract specific members of each object, to extract all the details, or to compute values for each object
Synonyms:
Select-Object
select
Selecting a subset of the properties:
$dir = dir "C:\MyFolder"
$dir | Select-Object Name, FullName, Attributes
$dir | select Name, FullName, Attributes
Name | FullName | Attributes |
---|---|---|
Images | C:\MyFolder\Images | Directory |
data.txt | C:\MyFolder\data.txt | Archive |
source.c | C:\MyFolder\source.c | Archive |
Selecting the first element, and show all its properties:
$d | select -first 1 *
PSPath |
PSParentPath |
PSChildName |
PSDrive |
PSProvider |
PSIsContainer |
BaseName |
Mode |
Name |
Parent |
Exists |
Root |
FullName |
Extension |
CreationTime |
CreationTimeUtc |
LastAccessTime |
LastAccessTimeUtc |
LastWriteTime |
LastWriteTimeUtc |
Attributes |