Search code examples
powershellobject-properties

Default sort property


Using PowerShell, I'm trying to understand the concept of default sort property.

According to this example, provided for the Sort-Object command :

PS C:\>get-childitem | sort-object

Because no properties are specified, Sort-Object uses the default sort property for objects of type file and directory, which is Name.

Is there a way to know, for any given type, which is its default sort property ?


Solution

  • In my understanding the default property is taken from the .ps1XML file for the predefined types. But I found nothing about that in about_Format.PS1XML