How does Windows (7 or later) determine what folder view to apply to a known (special) folder?

1

1

Problem:

I want to set the default folder view to Details for all folders on my Windows 8.1 Pro 64-bit computer. I have partly solved this problem as follows:

Setting Default Folder View (for most folders)

  1. Delete the following registry keys.

    HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU

    HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags

  2. Add the following registry entries.

    [HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags]

    [HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders]

    [HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\ComDlg]

    [HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\ComDlg\{5C4F28B5-F869-4E84-8E60-F11DB97C5CC7}]

    "Mode"=dword:00000004
    "Vid"="{137E7700-3573-11CF-AE69-08002B2E1262}"
    

    [HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\ComDlgLegacy]

    [HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\ComDlgLegacy\{5C4F28B5-F869-4E84-8E60-F11DB97C5CC7}]

    "Mode"=dword:00000004
    "Vid"="{137E7700-3573-11CF-AE69-08002B2E1262}"
    

    [HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell]

    "FolderType"="NotSpecified"
    

    [HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{5C4F28B5-F869-4E84-8E60-F11DB97C5CC7}]

    "Mode"=dword:00000004
    "Vid"="{137E7700-3573-11CF-AE69-08002B2E1262}"
    

Note if you try this, you'll need to restart explorer.exe for the folder view setting to take effect:

taskkill /f /im explorer.exe
start explorer.exe

I don't have a single reference that explains this; I've pieced it together from several references that might be incomplete or partly wrong.

Anyway, as I understand these entries (and please correct me if I'm wrong):

  • Shell/ComDlg/ComDlgLegacy mean that I want these settings applied to Explorer and to file dialogs.

  • {5C4F28B5-F869-4E84-8E60-F11DB97C5CC7} is the generic folder template, which you can find at:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{5c4f28b5-f869-4e84-8e60-f11db97c5cc7}

  • {137E7700-3573-11CF-AE69-08002B2E1262} is the Details view. It seems you must specify both a view ID and mode, and for the Details view the corresponding mode value is 4. See this article; unfortunately I don't have a firmer reference (such as one from Microsoft).

  • "FolderType"="NotSpecified" turns off automatic folder type discovery, which seems to interfere with this solution.

As far as I can tell this applies the Details folder view to all physical folders.

Known/Special Folders

However, it seems Windows has another type of folder called a "known" or "special" folder. Explorer usually shows some of these folders in the left pane or in a drop-down at the left of the address bar:

Special folders in Explorer

Here is a list of known folder IDs.

On your computer, you can find special folders listed in:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions

You can also view special folders on your computer with this tool.

I want to set the folder view for all special folders just as I have done for all physical folders. However, I cannot tell how Windows decides what folder view to apply to a special folder.

Here's what I do know. Suppose I open the special folder Libraries\Documents, which has FolderDescription GUID {7B0DB17D-9CD2-4A93-9733-46CC89022E7C}. Explorer shows this folder in Large Icons view, which contradicts the folder view I tried to set on all folders earlier.

When I refresh regedt32, I see that Windows has added the following registry entries:

[HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\1]

[HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\1\Shell]

    "TV_FolderType"="{FBB3477E-C9E4-4B3B-A2BA-D3F5D3CD46F9}"
    "TV_TopViewID"="{82BA0782-5B7A-4569-B5D7-EC83085F08CC}"
    "TV_TopViewVersion"=dword:00000001

The TV_FolderType value refers to another folder template like the generic folder template we saw earlier. Its name is Documents.Library and it can be found at:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{fbb3477e-c9e4-4b3b-a2ba-d3f5d3cd46f9}

Under that entry I see a key named TopViews, and under TopViews are six keys with GUID names, one of which matches the TV_TopViewID value we saw previously:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\\{fbb3477e-c9e4-4b3b-a2ba-d3f5d3cd46f9}\TopViews\\{82ba0782-5b7a-4569-b5d7-ec83085f08cc}]
    "ColumnList"="prop:0(34)System.ItemNameDisplay;0System.DateModified;0System.ItemTypeText;0System.Size;1System.DateCreated;1System.ItemFolderPathDisplay;1System.Author;1System.Category;1System.Keywords;1System.Title"
    "Order"=dword:00000001
    "SortByList"="prop:System.ItemNameDisplay;-System.DateModified"
    "GroupBy"="System.ItemSearchLocation"
    "LogicalViewMode"=dword:00000001
    "PrimaryProperty"="System.ItemSearchLocation"
    "Name"="@shell32.dll,-34817"

The "Order" = 1 value suggests this view was chosen because it is ranked #1 for this folder template.

I don't know how Windows decides to apply the Large Icons folder view based on this "TopView" information. I searched the registry for "{82ba0782-5b7a-4569-b5d7-ec83085f08cc}", but it only appears as a TV_TopViewID value in Shell\Bags, or in the TopViews lists of other folder templates. It's not in HKEY_CLASSES_ROOT\CLSID.

Partial (Ugly) Solution

I have partly solved this problem as follows. I do not recommend trying this on your computer. If you do, please back up the entries in question first.

  1. Delete the following registry key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{fbb3477e-c9e4-4b3b-a2ba-d3f5d3cd46f9}\TopViews

  2. Add the following registry entries:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{fbb3477e-c9e4-4b3b-a2ba-d3f5d3cd46f9}\TopViews]

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\{fbb3477e-c9e4-4b3b-a2ba-d3f5d3cd46f9}\TopViews\{00000000-0000-0000-0000-000000000000}]

    "ColumnList"="prop:0(34)System.ItemNameDisplay;0System.DateModified;0System.ItemTypeText;0System.Size;1System.DateCreated;1System.Author;1System.Keywords;1System.Title"
    "Order"=dword:00000000
    "LogicalViewMode"=dword:00000001
    "Name"="NoName"
    

This makes it so the Documents.Library folder template has the same set of TopViews as the generic folder template. That causes Explorer to use the folder view I specified for the generic folder template back in HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders.

Having to replace the TopViews list for every folder template seems crude (like I'm fixing the problem downstream of where I should) and possibly dangerous (because I don't know exactly how this all works).

Summary

To sum up, I want to tell Windows to apply a default folder view to all special/known folders as well as all physical folders.

I would also like to know:

  • How Windows determines the FolderType (folder template) for a given FolderDescription (special folder).

  • How Windows determines the folder view (Details, List, etc) for a given FolderType. I can infer that it looks up a TopView for the FolderType, but I don't know how it translates that to a folder view.

I've been searching, but I can't find this stuff documented anywhere.

Thank you and please let me know if I can provide additional information.

Edit: I said "Windows 7 or later" because I gather the registry entries in question changed between XP and 7.

Edit:

Better Solution

I found a better way to set the folder view for special folders, though it isn't as elegant as setting the folder view on normal folders.

Say I browse to the special folder Libraries\Documents. Windows creates the following registry entries if they do not exist:

HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{FBB3477E-C9E4-4B3B-A2BA-D3F5D3CD46F9}

HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{FBB3477E-C9E4-4B3B-A2BA-D3F5D3CD46F9}\{82BA0782-5B7A-4569-B5D7-EC83085F08CC}

    "Rev"=dword:00000003
    "FFlags"=dword:41200001
    "Vid"="{0057D0E0-3573-11CF-AE69-08002B2E1262}"
    "Mode"=dword:00000001
    "LogicalViewMode"=dword:00000001
    "IconSize"=dword:00000010
    "Sort"=hex:(omitted for brevity)
    "ColInfo"=hex:(omitted for brevity)

{FBB3477E-C9E4-4B3B-A2BA-D3F5D3CD46F9} is the folder template associated with Libraries\Documents.

{82BA0782-5B7A-4569-B5D7-EC83085F08CC} is the TopView with Order 1 associated with the folder template.

I do the following:

  1. Leave the keys alone.

  2. Delete all values except Vid and Mode.

  3. Set Mode to 4 and Vid to {137E7700-3573-11CF-AE69-08002B2E1262}.

  4. The next time I browse to Libraries\Documents, it has the Details folder view. I do not even have to restart Explorer.

I am able to set the folder views for the other special folders the same way.

As it turns out, if I simply browse to all the special folders and set the folder view on each, I end up with the same registry entries as if I set them manually.

The good news is I can do that and then export HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders and deploy the .reg file to another machine.

However, it would still be better to set the folder view once for all special folders.

FSharpN00b

Posted 2017-06-29T08:26:11.490

Reputation: 129

1Some folder settings are saved in desktop.ini file in that folder. Enable show hidden protected file and you can see desktop.ini file.in each folder. – Biswapriyo – 2017-06-29T08:47:48.710

Hi Biswa, in my Documents (special) folder I see two desktop.ini files, which contain some data labeled ".ShellClassInfo" but nothing about folder view settings. Same story for other special folders I opened at random. I hadn't thought of desktop.ini, though, so it might lead me to more info on how folder view settings are determined. Thank you. – FSharpN00b – 2017-06-29T09:18:00.197

In addition your example picture referred to Libraries and not folders. They might work differently as they (transparently) map to multiple locations. But there are options to disable the having them show up in explorer. – Seth – 2017-06-30T09:12:27.287

Hi Seth, yeah I considered simply disabling them, but some of these special folders I find useful. I think I have the problem mostly solved - I created a .reg file that applies my view settings to every folder template that can be applied to a special folder (basically an extrapolation of the "better solution" described above). When I run that on a clean VM it seems to work. I'll likely post it as an answer once I'm reasonably sure all the kinks are out. Thank you. – FSharpN00b – 2017-06-30T10:46:20.297

No answers