<

IconCache: Max Cached Icons DataType Reverting Incorrectly from STRING to DWORD **SOLUTION**

Published on
16,734 Points
10,634 Views
1 Endorsement
Last Modified:
Approved

In a hurry?.. scroll down to "HERE's HOW TO DO IT" Section.

Greetings All,
I was going to post this as question/solution, but its seems more appropriate as an article considering its length.  I felt it important to illucidate all the details carefully considering the rampant questions appearing everywhere on the internet.  This article should demystify a great deal about this issue.

There is a lot of bruha on the net about implementing Microsoft Windows IconCache Size fixes that seem to work only for some and not others.  There's a lot of confusion and dangling questions out there, with no viable solution.

What the heck is up with that anyway??!
Well here's the real poop, and a fix for your not so co-operative Icon Cache in Windows.
Oh, and for once... its not Microsoft's Fault ;^)

================================================
You probably found this little article because you have read that setting a value for Max Cached Icons in your registry will speed up (and smooth out) operations on your Windows PC System.
In fact, Windows will startup, and operate, really slowly without this feature working properly, as it is a primary feature in Windows.

BUT THE TWEAKS YOU FIND ONLINE AREN'T WORKING FOR EVERYONE,
AND THERE IS SOME CONFLICTING INFORMATION OUT THERE (people guessing)
that is leaving folks unsatisfied and/or confused, and just plain stuck.

===================================================
THE MAIN PROBLEM IS THIS:
Even after you implement a proper solution (like Kelly's for instance)
!! XP WILL Revert the "datatype" for "Max Cached Icons"
from a String (REG_SZ) datatype (what it is without question the correct datatype)
to a Dword (REG_DWORD) datatype
***under [un]certain conditions***.

BUT Not Only That, -->> if you are a victim of this particular problem, it is likely you are looking for a solution to this because the natural feature in Windows is broken by this problem to begin with, before you even applied any adjustments of your own!!

===================================================

WHY ??!
***It is little known that some Widcom Broadcom BlueTooth Drivers, even some of the newer ones subsequent to them supposedly addressing this issue in previous versions, have a conflict wherein they change some values in the registry incorrectly, ...this critical value being one of them!! AH HA !!

You can read all about it here (thank you so much, pincholas at PC Advisor!):
Widcom Driver Bug - PC Advisor

..And who knows who else's drivers might impose this problem (?now or later?) - I see so many complaints everywhere about how editing the Max Cached Icons feature is not working for people.  And if you have a wacky driver and cannot get the right one installed, you are stuck, period.

I looked all over the freaking internet and just when I was about to give up (somewhere near the end of the internet, I am sure [it said epilogue or something at, like, webpage kagillion or something...]) I found pincholas' posting.  After testing I was able to determine that this indeed was relevant to my issue.  Why just about no one else is posting about this, who knows, but it is plainly apparent that this is the relevant problem so many are facing with no proper answer.

BUT UNFORUTNATELY THE FIX DOES NOT WORK FOR ALL:
  After updating my drivers (time of this posting Feb 2010) I continued experiencing the problem ...<hhrrumph>...
  To top it off, if you have the datatype issue referred to herein, its even worse because the natural iconcache.db file feature in Windows ends up going totally unused, i.e., the problem defeats a basic essential function in Windows, so your system is constantly polling and creating icons in all relevant places as you work ...desktop, menu's, windows, open/save dialogs, etc).
<grrrrrrr>

**MY SOLUTION**
(..little steam release first...)
   I was really miffed that even after updating I could not get past this issue... so, what?.., if you want to use the bluetooth that comes built-in to your spanking new hot-rod system  you have to simply put up and shut up with lousy performance because of some essential component that insists on breaking a fundamental and critical featue of your operating system, ...no matter all the money you laid down for your power system???!
   And it really does add significantly to your overhead (major time consumption, this seemingly little issue of icons is) ...to have to live with constant rebuilding of icons - a 'primary' component in any graphical user interface no matter the operating system.

Ahem, okay Sooooo....

After finally sussing the correct understanding, without question, for the correct datatype to use,
 ...AND then when and how the problem occurs...

***I ended up creating a BATCH FILE for Automatically Resetting my desired registry entry ...that runs whenever Explorer loads or unloads (well pretty much... for now, at every Logoff and Logon); and so far my iconcache.db file is staying set and being used by the system correctly (seemingly), in spite of would-be bugger-uppers that keep insisting on inappropriately changing my registry.***

{HTH Dict: bugger-uppers... plural of noun 'bugger-upper', from the verb tense "to bugger up", based on pronoun 'nasty buggers', generally those who impose damage carelessly with impunity
...or something along those lines...}

I am still testing for the best timing for running my batch, but its doing okay for a few days now with the current parameters; so since I've come this far, and there's scant help for addressing this out there, I thought it does well to share this with others asap.

Below is the news (how to) so far. I'll update if needed.
Its only a single line of code really, but implementation is a little convoluted.
I have provided expert and newbie approaches to try to make it easy for anyone.
I hope you find this useful.
Thanks to all who have contributed in the spirit of sharing.
Best to all,
TwoHawks / HTH


#########################
HERE'S HOW TO DO IT...
#########################

IMPORTANT: BEFORE YOU START
===========================
Registry Editing Standard Disclaimer and Warning: Without rambling on about it... if you found this article then you have already read that this has to do with registry editing, and how that can be potentially dangerous to your system, and it is incumbent upon you to be careful, pay attention, backup, etc.
So you have been warned.

That said, this little bit of code is basically harmless, and should work on any version of Windows... 95 thru Windows 7.  (Wellll... Your mileage may vary if you are using really old versions I could not test on... if you do run into a wrinkle you should be able to iron it out with a little added Googling if need be.)

Caveat: This Fix relies on REG.EXE, which is not natively included on versions of Windows prior to XP, ..so if this is you, then you need to get it and install it...
Quote from Microsoft:
The registry can be manipulated in a number of ways from the command line. The reg.exe utility tool is included in Windows XP and later versions of Windows. Alternative locations for legacy versions of Windows include the Resource Kit CDs or the original Installation CD of Windows.

If nothing else, hunt it down at MS, or try heading on over to Daniel Petri's site and pick it up there...
http://www.petri.co.il/reg_command_in_windows_xp.htm

You can test to see if you have REG.EXE installed already by opening a command Prompt
 - Go to Start: Run: type CMD: Hit enter
 (older widows versions use COMMAND instead of CMD)
Then in the command window type
   Reg /?

{Can't find Run?  Try Win-R.  That's the Window's Logo Key plus the letter R on your keyboard. Thank you Windows for making things easier and safer by removing that from view/access by default.}

If REG.EXE is installed, its command info will be displayed. If not you will observe an error reported.

####################################
SO LETS GET STARTED >>>>>>>>>>>
====================================
The SHORT VERSION (for experts):
####################################
You will create a Command Batch File and add it in 2 Group Policy locations so it runs at logon (*after Exporer Loads) and logoff (*after Explorer unloads).  The timing is important because you need to re-address the entry right after it gets buggered (that's technical jargon for 'buggered'), or the fix won't work.  

(I'm still monitoring this because although it supposedly only happens after Explorer loads or unloads, I swear I have seen it happen at other times as well.  So this is not finalized, but its a good start, and on track, anyway.)

3 STEPS
---------------------
1) Create a Batch file and change its extension to ".cmd"

---------------------
2) Open it in your favorite text editor
 - and Place the following line in there

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer /v "Max Cached Icons" /t REG_SZ /d "3072" /f

 - edit the quoted number to your liking
 - and Save it :

The Above Line may be wrapped. It starts with "REG" and ends with "f"... be sure to copy the whole thing exactly.

I use number schemes 1024, 2048, 3072, 4096, 5120, 6144, 7168, 8192, etc
..but I am sure you could use 2000, 3000, etc., as well.
Try lower numbers first (starting at 20xx, and gradually increase until it feels right as you test it.

CHOOSING YOUR NUMBER >>
I am somewhat of a power user and 3072 to 4096 neighborhood is working well for me during early testing... on XPSP3, with 16 Windows open, traversing All of Start Menus, Opening 6 programs and traversing Open/Save Dialogs (generally speaking). I am also running context-menu and window enhancements to Explorer that allow me to traverse directories from just about anywhere, heavy use of which was also included in my testing.  Of course, when  I am coding (or whatever) I will start getting way more windows and apps going, but I don't yet know that that will definitely necessitate raising the number, and I like to be conservative for starters.

  As implied, I'm a bit conservative, so conversely, if you are using all kinds of different icon views and have other related enhancement features turned on that may affect more 'iconage' in your working environment, then I would recommend start testing at 4096.

Just remember that the larger the iconcache file the more time the System will spend "in it" when it is 'polling' it for icons, so keeping its size down to "just over what you need" will result in the best performance, imho.

NOW ON TO STEP...
---------------------
3) Open Group Policy Editor (Start: Run: gpedit.msc) and add your newly created command batch file to the following Group Policies:

a) Computer Configuration: Administrative Templates: System: Logon: Run these programs at user logon
b) User Configuration: Windows Settings: Scripts: "Logoff" script policy manager

Ehem... don't have Group Policies?  No worries... check the newbies section below for a workaround ;^)
 
DONE WITH INITIAL SETUP.   ...now on to testing...

==================================
TESTING SECTION (pros and newb's)
==================================
To Test, Basically:
1 - Adjust the number in the file you made (Newb's: Open My Computer (or Computer) and then open the root volume -> "Drive C:" in most cases, to find your file, right-click on it and select edit, make your change, then save it [not SaveAs, simply select File: Save], then Close the text editor)

2 - Delete your iconcache.db file: location C:\Documents and Settings\<userprofile>
 .- or delete your ShellIconCache file in your C:\Windows or C:\WinNT folder (older Windows versions, see below)

3 - Log off and then back on  (older versions, restart, see below)

4 - Test: open windows and traverse menus and open/save dialogs (i.e., go lots of places in order to "initialize" the iconcache file)

5 - Log off and then back on and "test:" again -->>

6 - Test thru a restart or two as well

7a - Note the performance: this is the general performance you can expect to experience at the current setting.  After you log in, when they start coming you should see your Desktop Icons appear straight-away all-together (pretty much) rather than slowly filling in piecemeal... Same thing in windows and menus, etc.  Everything should be fairly snappy from the outset ;^)
7b - Note the iconcache file size: I don't yet know if/how this file may or may not resize itself over the course of days, etc.  I'm still looking at how that performs or may change, but noting the size as you test is definitely relevant.

8 -Now Set a different Number  in your file and Start Testing again (from #1] to compare how another setting performs comparatively.  

When its running the way you like, you are...

DONE WITH FINDING YOUR SWEET-SPOT NUMBER

FINI !!

=============================
TESTING AND FINISHING NOTES
In all the shooting I lost track of where/when exactly log ins/outs vs restarts may be necessary or significant, but I've been pretty lucky ;^).   Generally speaking...,

 In XP and above, each user's profile has its own iconcache.db file, and that's not dependent upon initial system loading, so logging on/off is fine, except I am still tracking some uncertain behavior (as mentioned in my opening) so need to test both (mostly log ins/outs with occasional restarts);

**however, older systems using ShellIconCache file located in the Windows folder, not the User's Profile folder, should 'require' restarts for rebuilding, and even may require booting into safemode in order to delete the file.

Per that last issue, you can find a utility for Delete On Boot (or ReStart) on the internet somewhere that will alleviate the need to boot to safemode ;^)

-----------------------
If you Use Kelly's Excellent Tweak for the Folder Options selector, you can either edit the reg file provided so it includes your desired settings, or uninstall it altogether as its not really needed or useful anyway if you are having to use this fix.

-----------------------
Whew... who'd-a thunk it would require so much attention to apply a fairly meager fix!...
 ...thank you Broadcom for addressing this, and then not keeping up with it after you know about... ::jeez::...
{hey, could've been worse, ...we may never have discovered the source of this issue !!}


##############################################
Okay then, Now The Long Version (for newbies)
##############################################
::sip of coffee::

We are going to create 2 files you need. One will be used for setting up policies for you (without you having to figure out the Group Policies Editor stuff).  The other one is the actual settings file (Command Batch File) that you will test and tweak.  
  If you are concerned about editing the registry (and you should be) get a friend with moderate experience to safely help you ;^)
{Moderate experience means they'd read this and say, "oh yeah, I get that, no problem ;^}

BEGIN
======================================

CREATE A File
1) Open 'My Computer' (or 'Computer') and then open the root volume..., "Drive C:" in most cases.

2) Right-Click in a blank space in the window pane on the right side (i.e., not directly on any files or folders) to present/access the 'Context-Menu'
 - navigate the Context-Menu to "New: Text Document"
 - and then left click on that last bit ...to create a new file for editing.

NAME It
3) Type in a Name and hit Enter: it can be anything, for instance, "MaxCacheIcons_Reassertion" (without the quotes) is the name I will use here.
   If you see ".txt" on the end of the name, leave it on there for now (don't delete it).  
   If you don't see it, don't concern yourself.  

EDIT It
4) Now Double-click the file to open it for editing (BUT ONLY IN THIS STEP - in future you will have to use the Right-Click menu for Editing this file).  
 It should open in Notepad.  
 !!! If it doesn't then something is amiss.  You should have created a "text" document.  
 Do not continue until you have a text file that, when you double-click it, opens in NotePad!

5) Paste the following line into the file you just opened:

REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer /v "Max Cached Icons" /t REG_SZ /d "3072" /f

The Above Line may be wrapped in this post. It starts with "REG" and ends with "f"... be sure to copy the whole thing exactly.

About CHOOSING a NUMBER
During testing I used number schemes 1024, 2048, 3072, 4096, 5120, 6144, 7168, 8192, etc
..but I am sure you could use 2000, 3000, etc.
Try lower numbers at first (starting at 20XX), and while testing gradually increase until it feels right.
I am a power user and 3072 / 4096 neighborhood works well for me (on XP) so far.

SAVE It
6) Save your File: ***do not do a regular save***, but do this instead...
 - Go to the Menu: File: SaveAs
 - In the "File name:" box appearing near the bottom where you should see your file's name
   **Surround the filename with double-quotes, and be sure it ends in .cmd
   example:  "MaxCacheIcons_Reassertion.cmd"   ...WITH the quotes
 - Click the Save Button to save this file onto your Drive_C:
 - Close the Notepad editor

Windows will convert this file into the correct format (from a Text file to a Command Batch File) for you.  Hmmm... I am farily certain older versions of Windows does this but I cannot test here.  If you have problems saving the file to the correct type, then see "FILE TYPE ISSUES SECTION" below, sort it out, and then continue on to Step #7...

APPLY YOUR POLICY SETTINGS....
7) If you know how to handle the Group Policy Editor (check it out at Start Menu: Run: type gpedit.msc, Enter) then continue with the short version instructions section above until DONE and that's it.  If not, (or if its not installed in your version of Windows [XP Home Users]) following is a direct/easy method for setting the policies up in your registry...
  {oh yeah, Win-R on your keyboard is same as "Start Menu: Run:" }

.....***OR DO IT THIS WAY INSTEAD***....
CREATE ANOTHER NEW FILE,
etc, following Steps 1 thru 4 above;

NAMING IT
however, this time use a name something like
 - "Iconcache Policy Keys"  ...withOut the quotes.

You should now be in the Notepad editor...

EDIT It
8) Copy and Paste the below code into this file.  
Note, the first line will be different in Versions of Windows prior to 2000, as indicated:
Select the relevant first line, deleting the other one, and deleting the ";..comment portion.." as well in the chosen line.
For example, in XP the first line is simply
Windows Registry Editor Version 5.00

;=====Begin File (don't use this line)=============
Windows Registry Editor Version 5.00 ;<<-- First Line for Windows NT5 +, 2000 +, XP, Vista, & 7
REGEDIT4 ;<<-- First line if you use Windows 95, 98+, or NT4

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\System\Scripts\Logoff\0\0]
"Script"="Reset MaxIconCache datatype"
"Parameters"="C:\\MaxCacheIcons_Reassertion.cmd"
"ExecTime"=hex(b):00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\Run]
"1"="C:\\MaxCacheIcons_Reassertion.cmd"
;=====End File (don't use this line) =============


SAVE It
9) To Save, ***do not do a regular save***, but instead do this...
 - Go to Menu: File: SaveAs
 - In the "File name:" box appearing near the bottom where you should see your file's name
   **Surround the filename with double-quotes, and be sure it ends in .reg
   example:  "Iconcache Policy Keys.reg"   ...With the quotes
 - Click the Save Button
 - Close the Notepad editor

Windows will 'convert' this file into the correct format (from a Text file to a Command Batch File) for you.  Hmmm, again... I am fairly certain that older versions of Windows does this but I cannot test here.  If you have problems saving the file to the correct type, then see "FILE TYPE ISSUES SECTION" below, sort it out, and then continue on from here.

NOW APPLY YOUR POLICY SETTINGS
10) Now GoTo Your "My Computer: Drive C:" to find the file you just made...
 - Double-click it in order to enter those settings into your registry
 - click okay when prompted

DONE WITH INITIAL SETUP.   ...now on to testing -->>

=======================
NEXT:  SEE TESTING SECTION (ABOVE in Expert Section) for running your tests and adjusting your desired settings.

When complete, you are DONE WITH FINDING YOUR SWEET-SPOT NUMBER

FINI  !!


================================================
================================================
The above procedures should work for all versions of Windows; however, I am not absolutely certain about windows 95 (been so long), but it can't hurt.
If your Drive Letter (or File Paths) were/are different in any of that, then you need to adjust code accordingly.


#######################################
REFERENCE
#######################################
FILE TYPES ISSUES SECTION
#######################################

If you had trouble saving to the correct file format in Step 6 above, then try this instead...


#X) To Save, ***do not do a regular save***, but do this...
 - Go to the Menu: File: SaveAs
*Observe the "Save as type:" drop-down menu appearing below the "File name:" box near the bottom where you should be seeing your file's name...
 - Click on the down-arrow to the rightside end of the "Save as type:" menu
 - Select "All files"
Now...
 - In the "File name:" box
   Just be sure your filename ends with .xxx  (where xxx is the relevant extension from the directions you are following above)
   example:  "MaxCacheIcons_Reassertion.cmd"   ...withOut the quotes
        or:  "Iconcache Policy Keys.reg"   ...With the quotes
 - Click the Save Button to save this file onto your Drive_C:

================================================
END
================================================
1
Author:twohawks
Ask questions about what you read
If you have a question about something within an article, you can receive help directly from the article author. Experts Exchange article authors are available to answer questions and further the discussion.
Get 7 days free