How to force custom default Sort By options for all folder types in Windows Explorer
Quick note to eager mods: this is not a duplicate :)
My question has 3 parts, but to make it easy, of course I will mark as answered any answer that only addresses the 3rd part:
-
I wish to understand how Windows Explorer works in the sense of why this happens. I know folders can be of different types (general, music library, photo gallery etc) and that windows automatically decides which is which continuously based on what's in a folder. There's also different (types of) drives in a system, external drives, music player drives, phone drives whatever. All of these in addition to it being a folder by folder setting, contribute to the problem but I can't piece together how come the Sort By items lists get reset.
- For instance: I go to D:\Downloads\ in Explorer and go to Sort By and go to More and scroll all the way down to Date Modified, and click okay, then go to Sort By again and select Date Modified. Cool. Now, I go in my browser and save a file, browser asks where to save, I browse to D:\Downloads\ GUESS WHAT? DATE MODIFIED ISN'T THERE. Ok, I set it again there as well. I open another program with another windows shell browse menu, date modified isn't there either. I set all of them, reboot and/or install a totally useful windows update, it gets reset again.
- ^ Why is it not even actually per folder but per shell, and why does the Sort By list get reset? Where is this setting stored?
-
I normally would have asked what most seemingly related questions on this topic on SU ask (like this, and this):
- How to change my Sort By options and then apply them to all folders. - Bad question to ask and answer, because it will get reset, or will not really be applied to all types of folders and all future drives and connected devices.
- How to force all the folders on my system to be a "general items" folder so that then I can change the Sort By options for all my general items folders. - Also a bad question because a. I want to have different types of folders not just general items folders, and b. it as sure as anything in the universe, will eventually get reset by MS whether on purpose, or design stupidity.
-
If you've made it this far and with this knowledge think you have an elegant permanent answer please help us, maybe just answer this 10y/o question. But, I'm gonna ask a different question:
- Is there any sort of developer way to access, or an existing shell extension hack, or background process, or something, I don't care how invasive, that we can leverage, to continuously overwrite the Windows Explorer Sort By list with the actual Sort By criteria of --OUR-- choosing? Thank you very much.
- Clarification: My goal simple: for any and all windows explorer windows where there is an option to right click and go to Sort By menu, to be able to find Date Modified in there (and other custom options of my choosing, size, date taken etc). Then if I choose to Sort By Date Modified, I want that change to be remembered forever until I change it again. I would be OK with a solution where if I choose Date Modified in one folder, for all other types of folders everywhere else to also change to Date Modified globally. Seems like more sustainable than per-folder settigns.
In the last years, Windows As A Service releases have brought huge overhauls and investments, questionable at best (e.g. making windows drivers hostage to the invasive app store nobody wants), and yet everyday-things like this problem or the max file path length, have remained unaddressed or unanswered for decades. Makes you question whether anyone working at MS uses their own product non-superficially. No, but I'm sure they care, I guess they gosh just still don't have enough telemetry to know that this totally-in-your-face basic QA problem is a problem...
I've been working on a comprehensive explanation of folder views here. Take a look at that for starters.
You first question has me wondering if you've "maxed out" on saved views. What value is returned by this PowerShell code?
((gp "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU").Nodeslots).count
And what is you ultimate, specific goal??? I've found a couple of ways to custiomzie view defaults.
Apply to Folders is the easiest way to customize view defaults. To check which FolderTypes have a custom default set, run this PowerShell:
(Get-Item 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Defaults').Property |
%{(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\$_").CanonicalName}
If you've done all the basic types & the corresponding types under OneDrve, the output will look like this:
PS C:\> (Get-Item 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Defaults').Property |
>> %{(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\$_").CanonicalName}
Downloads
Generic
Documents
Music
Pictures
Videos
StorageProviderGeneric
StorageProviderDocuments
StorageProviderPictures
StorageProviderVideos
StorageProviderMusic
PS C:\>
Appoly to Folders, will affect previously saved Explorer views but not previously saved Common Dialog views, so to ensure your prefences are applied to dialogs as well, run the following code:
$Defaults = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Defaults'
$Bags = 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags'
$Custom = ( gi $Defaults ).Property
( gci $Bags -Recurse -depth 1 | ? PSChildName -match 'ComDlg' ) |
gci | ? PSChildName -in $Custom |
Remove-Item -Recurse
If you want to customize defaults for SearchResults & LIbraires as well, we have to create registry entries that don't normally exist, but see how the above works out for you first.
It remembers what you last did.
Understanding Saved Views and Browsing Folders
In Windows 2000 Professional, the view you use is not always permanently saved in Windows Explorer. You can control whether the views you use are saved permanently or temporarily by using the Remember each folder's view settings check box on the View tab of the Folder Options dialog box (see figure 9.3).
By default the Remember each folder's view settings option is enabled.
When you choose to leave this setting enabled, the following happens:
a.. The changes you make to a folder's view is automatically saved when you close the folder.
b.. The view you use to view one folder is not applied to other folders.
c.. When you open a folder, it opens in the view you used when you last viewed it.
When you clear the check box for Remember each folder's view settings, the following happens:
a.. When you start Windows Explorer, the first folder you view displays in the folder's saved view. Windows Explorer holds that view in temporary memory and applies it to all the folders that you visit while Windows Explorer remains open unless you manually alter the view.
b.. As you browse to other folders (after the initial folder is opened), the saved view for each folder is ignored, and when you quit Windows Explorer, the folder view that you have been using to view multiple folders is deleted from temporary memory.
c.. The next time you open Windows Explorer, once again, it is the saved view of the first folder you open that determines how you view multiple folders.
Setting All Folders to the Same View
Some users want to have all their Windows Explorer folders set to the same view. In Windows 2000 Professional, the default setting is that any change made to a folder's view is automatically saved when you close the folder and is not applied to other folders. However, you can set all folders to the same view by using the Folder Options command as described in the following procedure.
To set all folders to the same view
1.. In My Computer or Windows Explorer, set the view to your preference.
2.. On the Tools menu, click Folder Options.
3.. In the Folder Options dialog box, click the View tab.
4.. Under Folder Views, click Like Current Folder.
Important The Remember each folder's view settings check box on the View tab of the Folder Options dialog box (see Figure 9.3) affects how the view settings of individual folders are applied and saved. For more information about the impact of clearing this check box, see "Understanding Saved Views and Browsing Folders" earlier in this chapter.
Windows 2000 Resource Kit
Some references apply to old versions of windows and have been moved.
You have to do Apply To All while in a file folder. For each type of object (File Folder, Control Panel, My Computer, etc) that you do an Apply to All in it's clsid and the settings are created/updated at
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Defaults
{F3364BA0-65B9-11CE-A9BA-00AA004AE837}
is ordinary folders, and other
numbers are what ever they are (My Comp, Control Panel, etc - note My Docs
is an ordinary folder). They only appear IF you do an apply to all in that
type of object.
as well as a higher set of defaults at
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Streams\Settings=
So the point being in the order that you do things. You want to do your overall default setting last. This is how I advised someone who asked
Can someone please tell me how to force Windows to keep the seperate folder view settings I choose? I have checked and rechecked the box in folder options for it to remember, but it has no memory for that issue. To be more specific; I want to always have the thumbnail view in My Pictures and also in the Control Panel Dialog, but every time I open them I have to manually set that view.
Set Control Panel how you want then Tools - View - Apply To All Folders. This sets the global default and the Control Panel type of objects defaults (but the system default remains the same - it can't be changed but all other defaults/settings override it). Then go to an ordinary folder (as My Pics is for this feature) and set it how you want all folders but CP. Then Tools - View - Apply To All Folders. This sets the global default and the file folder type of object defaults (CP's default settings will still override the global). Then set My Pics how you want it and do nothing else as we are saving it by the checkbox Remember Folder Settings AND BY THE PATH WE GOT THERE. EG
Desktop\My Comp\C:\Documents & Settings\user name\My Docs\My Pics
is a different setting to
Desktop\My Comp\My Docs\My Pics
There is some searching for similar settings but the path used, if too different, means it won't find the settings for similar named folders.
The system defaults (and saved settings for individual folders already opened) are the only setting unless you've done an Apply To All, eg no global or type defaults.
Plus if you hold down control and click close while in a file folder it also updates
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer
Shellstate=
This is mainly setting irrelevent things except it holds the global sort, which all the others override. But File Open dialog boxes only use this setting, so it basically only affects sorting in File Open dialogs. But it seems that sometimes an earlier windows versions setting get written here and other settings then aren't saved
typedef struct {
BOOL fShowAllObjects:1;
BOOL fShowExtensions:1;
BOOL fNoConfirmRecycle:1;
BOOL fShowSysFiles:1;
BOOL fShowCompColor:1;
BOOL fDoubleClickInWebView:1;
BOOL fDesktopHTML:1;
BOOL fWin95Classic:1;
BOOL fDontPrettyPath:1;
BOOL fShowAttribCol:1;
BOOL fMapNetDrvBtn:1;
BOOL fShowInfoTip:1;
BOOL fHideIcons:1;
BOOL fWebView:1;
BOOL fFilter:1;
BOOL fShowSuperHidden:1;
BOOL fNoNetCrawling:1;
DWORD dwWin95Unused;
UINT uWin95Unused;
LONG lParamSort;
int iSortDirection;
UINT version;
UINT uNotUsed;
BOOL fSepProcess:1;
BOOL fStartPanelOn:1;
BOOL fShowStartPage:1;
UINT fSpareFlags:13;
} SHELLSTATE, *LPSHSHELLSTATE;