In which order does Windows Explorer sort folders when sorting the results of the search by size?

Solution 1:

Actually, the primary sort in the "Top Results" view ( the default ) of most SearchResults folders is a property hidden from dislpay: System.Search.Rank. This can be verified by examining the varous TopViews defined under: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes

$FTPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes'

### Dictonary FolderTypeID -> FolderType.CanonicalName
$FTKey     = Get-Item $FTPath
$FT_Lookup = $FTKey.GetSubkeyNames() | ForEach{ $hash = @{'{25CC242B-9A7C-4F51-80E0-7A2928FEBE42}'='Network'} } {
     $hash.Add( $_, $FTKey.OpenSubkey($_).GetValue('CanonicalName') )
} { $hash }

gci $FTPath |
  ? { $_.GEtValue('CanonicalName') -match 'SearchResults' } -PipelineVariable FType |
    gci -Path { Join-Path $_.PSPath TopViews } | gp | ? Order -eq 0 |
 Select @{ 'N' = 'FolderType' ; E = { $FT_Lookup[$FType.PSChildName] }} ,  SortByList

FOlderType                   SortByList
----------                   ----------
Contacts.SearchResults       prop:System.ItemNameDisplay;-System.DateModified
Documents.SearchResults      prop:-System.Search.Rank;-System.DateModified;System.Ite...
OtherUsers.SearchResults     prop:-System.Search.Rank;-System.DateModified;System.Ite...
Pictures.SearchResults       prop:-System.Search.Rank;-System.ItemDate;System.ItemNam...
Communications.SearchResults prop:System.Contact.FileAsName;-System.Message.DateRecei...
UsersLibraries.SearchResults prop:-System.Search.Rank;-System.DateModified;System.Ite...
Music.SearchResults          prop:-System.Search.Rank;-System.DateModified;System.Ite...
Generic.SearchResults        prop:-System.Search.Rank;-System.DateModified;System.Ite...
PublishedItems.SearchResults prop:-System.Search.Rank;System.ItemNameDisplay;-System....
UserFiles.SearchResults      prop:-System.Search.Rank;-System.DateModified;System.Ite...
Videos.SearchResults         prop:-System.Search.Rank;-System.ItemDate;System.ItemNam...

Solution 2:

Looks like it's partly 'computer sort' ie, the order it found them, by directory.

Presumably, the search has no size information for directories, so it just throws them up in the order it finds them. Within each sub-directory looks like it has managed alphabetical.