Powershell dot notation vs select-object

Can someone explain to me what is the difference between dot notation and select object in Powershell? How do these two property accessors differ from each other?

I noticed that launching (ls).name

gives basically the same results as ls | select-object name

, however launching ls | select-object name | export-csv foo.csv

gives me the correct csv file when I try (ls).name | export-csv foo.csv

it gives me a file length. In both cases, gettype () returns Object []

+3


source to share


1 answer


The cmdlet select-object

wraps the result in a new object. To see the differences (look at the type) use the cmdlet get-member

.

(ls).Name | get-member

      



and

ls | select-object Name | get-member

      

+3


source







All Articles