Can't find the BagMRU Size value, my folder settings are getting lost

This is an old problem dating back to Windows XP, now on my Windows 7 64-bit system it is starting to lose folder view settings when it comes to Details, List, Icons etc, everything else is stable for position and size. I tend use details view for most things and now folders are starting to revert to icon view sometimes, not 100% of the time mind you, but seems to be more frequent the more I use the PC.

Yes I do have thousands of folders, so I think the default cache size is used up, exact same problem I had with Windows XP.

I cannot seem to find a definitive instruction on where to find the folder view cache setting in the registry for Windows 7 64-bit, there are tons of answers for XP (which I have used in the past), and Vista and some Beta/RC Windows 7.

I did find this article from Microsoft.

In the "let me fix it myself" section for Windows 7 64-bit, I don't have the sub key Local Settings under the key Wow6432Node as per Microsoft article.

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

I do however have this key.

HKRU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell
\Bags and \BagsMRU

Scanning the registry for BagMRU Size values (not keys) returns no hits. I assume Windows 7 no longer uses this value by default.

Any suggestions to increase the cache size for view settings without completely resetting the entire explorer folder settings?

Does anyone have any insight to what the max stable cache size is allowed for W7? and where to change/add this value.


Edit:

I found my old notes from the Vista and XP days, I no longer have the reference link.

Windows Vista

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

Create a DWord 32-bit BagMRU Size and set the decimal value to 10,000 or 20,000

Sometimes folder settings get corrupted. Use regedit to view

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

Click on Bags and select Edit > Delete > Yes. Delete the BagMRU key as well, and restart.

Windows XP

Windows XP SP2 fix: By default SP2 has a folder cache setting of 5,000 folders to remember view settings for each folder, if you have in excess of 5,000 folders (total of all harddrives) you have to make a registry change and up it to the maximum of 8,000. to do this Start-Run-regedit and navigate to these two folders

HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell

then go to

HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam

in the right hand pane look for BagMRU size, right click modify and select decimal and set value data to 8,000. Do this in both locations, reboot to take effect.


I will experiment over the next few days and report back any enlightenment.


Analysis

Using Process Monitor on Windows 7 x64 I see the following when I restart explorer and randomly browse:

  • Access under
    HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags

  • Access under
    HKCU\Software\Microsoft\Windows\Shell\Bags

  • Access at
    HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU Size

    (This does not exist on my computer, but it is requested)

  • Access under
    HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU

  • Access under
    HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\Directory\OpenWithList\MRUList

    (This does not exist on my computer, but it is requested)

Conclusion

So, our %WINDIR%\Explorer.exe only accesses the 64-bit keys for our Bags.

However, the Wow6432Node keys are accessed when you use %WINDIR%\SysWOW64\explorer.exe,
there might be some contexts where the 32-bit explorer is used so take caution. For example, when it is launched from a 32-bit context or maybe when you launch Windows Explorer from a File Dialog.

To clear the Bag information, it is indeed sufficient to recreate the Bags and BagMRU folders under:

  • HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\

And although it is less used it might help to recreate the Bags folder under:

  • HKCU\Software\Microsoft\Windows\Shell\

The value of BagMRU Size is requested, so it's not really good that the key is absent. It could result in undefined behavior but I'm taking a wild guess that it just uses the default instead in the code. To be sure and run less fast into the limit you could define the DWORD value with a large number in the following key:

  • HKCU\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\BagMRU Size

The last key that is accessed is when you would open a MRUList with Explorer.exe, I don't think that this is ever needed as there is no such thing as opening a Most Recently Used List other than to showing that in something like the Start Menu. So it's not necessary to create that key.

Any suggestions to increase the cache size for view settings without completely resetting the entire explorer folder settings?

I would say that you could solely create and increase the BagMRU Size setting under the assumption that your Bags settings aren't corrupt... I've answered the other question under your question.


Indeed, that's an irritating issue. From my experience, once this cache is full, Windows doesn't remove oldest entries and just doesn't remember settings for new folders...

Good news, it seems we can increase the default of 5000 entries in Windows 7.
See this article: Fix: Windows forgets Folder View settings

  • Navigate to HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell
  • In the right side pane, "right click > New > DWORD (32-bit) Value". Name it BagMRU Size
  • For the value, select Decimal and type e.g. 10000 (or in Hexadecimal base type 2710).
  • Reboot.


The entries are stored under these two 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

To empty the cache, you can simply delete both keys.


You may also have a look at this NirSoft utility to view the cache status: ShellBagsView.