Like

DESCRIPTION

A comfortable replacement for Select-Object -ExpandProperty.
Allows extracting properties with less typing and more flexibility:

Preferred Properties:
By defining a list of property-names in $DefaultExpandedProperties the user can determine his own list of preferred properties to expand.
This allows using this command without specifying a property at all.
It will then check the first object for the property to use (starting from the first element of the list until it finds an exact case-insensitive match).

Defined Property:
The user can specify the exact property to extract.
This is the same behavior as Select-Object -ExpandProperty, with less typing (dir | exp length).

Like / Match comparison:
Specifying either like or match allows extracting any number of matching properties from each object.
Note that this is a somewhat more CPU-expensive operation (which shouldn’t matter unless with gargantuan numbers of objects).

EXAMPLES

EXAMPLE 1

dir | exp

Expands the property whose name is the first on the defaults list ($DefaultExpandedProperties).
By default, FullName would be expanded.

EXAMPLE 2

dir | exp length

Expands the length property of all objects returned by dir.
Simply ignores those that do not have the property (folders).

EXAMPLE 3

dir | exp name -match

Expands all properties from all objects returned by dir that match the string “name” (“PSChildName”, “FullName”, “Name”, “BaseName” for directories)