Windows doesn't remember "sort by" folder settings

Page 2 of 4 FirstFirst 1234 LastLast
  1. KeithM's Avatar
    Posts : 795
    Microsoft Windows 10 Home
       #11

    Sorrymyen said:
    Many thanks for the tip. It really worked for all file properties, except for "subject" and "author".


    When these two properties are used to sort files, the system is unable to memorize them when the folder is opened again, returning to alphabetical order. Can anyone reproduce this with "subject" and "author" to confirm whether it is a Windows limitation or a corruption of my system?
    What filetypes have these properties? What Foldertype (Documents? Generic?)? I encountered a similar issue with music folders & one of the artist fields. Had to work some registry magic.
      My Computer


  2. Posts : 30
    Windows 10 v1809
       #12

    I have this behavior with video folders ("author") with mp4 and mkv files and document folders ("subject") with doc, txt, rtf, pdf, cbz... p.s: not tested in other types of folders.
      My Computer

  3. KeithM's Avatar
    Posts : 795
    Microsoft Windows 10 Home
       #13

    Hope you haven't been feeling forgotten! I fainted while bicycling, went down hard, & been hurting bad.

    This behavior is similar to what I've seen before. The workaround around is to run a bit of PowerShell code after you set your desired sort and close the folder and before you open the folder again. The sort is written to the registry when the folder is closed, but for some reason, will get wiped out upon re-opening the folder unless the sort value is modifed by the below code. Here is the code itself:



    Code:
    $Bags = 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags'
    
    gci $Bags -recurse | ? Property -contains Sort | gp | ? { $_.Sort[0x10] -eq 4 } | ForEach{
       $NewSort       = $_.Sort[0..0x2B]
       $NewSort[0x10] = [Byte]1
       $Splat = @{
          Path  = $_.PSPath
          Name  = 'Sort'
          Value = $NewSort
       }
       Set-ItemProperty @Splat
    }
    We can wrap this in a function named Fix-BadSorts and add it to your profile so it's available in any PS session:
    Code:
    @'
    Function Fix-BadSorts {
    $Bags = 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags'
    
    gci $Bags -recurse | ? Property -contains Sort | gp | ? { $_.Sort[0x10] -eq 4 } | FOrEach{
         $NewSOrt       = $_.Sort[0..0x2B]
         $NewSOrt[0x10] = [Byte]1
         $Splat = @{
            Path  = $_.PSPath
            Name  = 'Sort'
            Value = $NewSort
         }
         Set-ItemProperty @Splat
    }}
    '@ | Add-Content $PROFILE
    You can then create a clickable shortcut using the New > Shortcut dialog with the Target:
    Code:
    PowerShell -Command Fix-BadSorts
    Also, once you've re-displayed the folder and verified the sort, you can use Apply to Folders to set the sort as the default for that Foldertype.
      My Computer


  4. Posts : 30
    Windows 10 v1809
       #14

    I hope everything is ok with you now, Keith, and thank you for your help.

    However, the code unfortunately didn't work for me. I think that this is not a problem of registry corruption, as this is repeated here on another computer. Maybe a Win10 bug. Could you confirm if you can sort items by author and subject and keep them sorted after reopening the folder?
      My Computer

  5. KeithM's Avatar
    Posts : 795
    Microsoft Windows 10 Home
       #15

    Another quick test showed the code working for me. I'm testing with .eml (saved mail messages) as they have both Author & Subject properties.

    Did you set your sort on Author or Subject, close the folder, then run the code from the first code block? If you ran the code in the second block, you added the function to your profile, but you then need to open a new PowerShell window to load the new profile & then call the function by typing Fix-BadSorts. I wasn't that clear on that in my first reply.

    The other thing to check is that you haven't "maxed out" on saved views --- where Windows has to delete one view before it can save another. Copy & paste the following code into a PowerShell window. If it returns 5000, you're maxed out & need to delete two registry keys:

    Code:
    HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU
    HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags
      My Computer

  6. KeithM's Avatar
    Posts : 795
    Microsoft Windows 10 Home
       #16

    I just looked up my answer to a similar question about sorting on Contributing Artist and saw the easy fix I'd forgotten I'd found!!!

    After selecting your primary sort column & direction, set a secondary sort by Shift+<Click>ing on another column header. Setting a secondary sort over-rides the default behavior that causes the sort to be lost.

    Clicked on Author, Shift+Clicked on subject:
    Windows doesn't remember &quot;sort by&quot; folder settings-screenshot-799-.png
      My Computer


  7. Posts : 30
    Windows 10 v1809
       #17

    I lost my computer and it took me a while to find my backups to reproduce the behavior and test its tips. Still unsuccessful using PowerShell or clicking Author + Shift + Subject.
      My Computer

  8. KeithM's Avatar
    Posts : 795
    Microsoft Windows 10 Home
       #18

    Acckkkk!!! I forgot to post the code to check the count of saved views! That last code block is just the two registry keys you delete to clear saved views -- nothing executable about it! Sorry!!! Copy & paste the following to get the count of sved views:

    Code:
    ((gp "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU").Nodeslots).count
      My Computer


  9. Posts : 30
    Windows 10 v1809
       #19

    I insert -Command Fix-BadSorts in PowerShell
      My Computer

  10. KeithM's Avatar
    Posts : 795
    Microsoft Windows 10 Home
       #20

    Sorrymyen said:
    I insert -Command Fix-BadSorts in PowerShell
    Is that doing the trick?
      My Computer


 
Page 2 of 4 FirstFirst 1234 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 01:28.
Find Us




Windows 10 Forums