New
#11
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.
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:
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:$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 }
You can then create a clickable shortcut using the New > Shortcut dialog with the Target: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
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.Code:PowerShell -Command Fix-BadSorts
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?
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 typingFix-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
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:
![]()
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.
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