May 28th, 2019

Why does Explorer’s New menu take so long to appear the first time I open it?

When you right-click on an empty space in an Explorer folder and select the New menu item, there is sometimes a delay of up to two seconds before the menu appears. What’s going on during that delay?

The items in the New menu are discovered by looking for Shell­New subkeys in HKEY_CLASSES_ROOT.

This search takes some time, seeing as HKEY_CLASSES_ROOT is a rather large registry key. The New menu starts a background task to collect all the information and waits up to two seconds for it to report results. If the task doesn’t finish within two seconds, then the New menu gives up waiting and merely shows the result from the previous time the task ran, hoping that no new items were added in the meantime.

Meanwhile, the task continues to run and eventually completes with a list of items. If it finishes in time, the New menu will use it right away. Otherwise, it is saved for the New menu to use next time.

This is the similar sort of nonsense we went through with the COM component category catalog.

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

13 comments

Discussion is closed. Login to edit/delete existing comments.

  • Marc K

    This is super annoying.  I’d prefer if Explorer did the scan at startup (or soon after) and then used RegNotifyChangeKeyValue to update as things change.  My computer will be running for days and I’ll still regularly find myself waiting for 3 seconds for the New menu.

  • Mystery Man

    Somehow, I don’t think you are talking about the Windows 10 v1809 bug that causes the New menu to appear after a long delay, every time. Microsoft says this issue has been resolved in 1903.

    • Marc K

      It is working better on 1903.  I wonder if this means Windows Server 2019 users are going to have to live with this bug for the next 10 years.

  • Dmitry Vozzhaev

    And in such indices, althougo small pricks To their subsequent volumes, there is seen The baby figure of the giant mass Of things to come at large.
    You know, caching is only one of two methods to speed up lookup queries. 

  • Joe Beans

    It took me about 100-200 lines of C# to recreate the enumeration and construction of the New menu but I was hoping there was a way Windows could do it for me similar to IContextMenu. I hand you a folder PIDL/IShellItem and a menu handle, you fill it with New items, and then I tell you which command to activate. Everyone who creates their own Explorer replacement (or Open/Save As window) has the conundrum of being...

    Read more
    • W S

      CLSID_NewMenu but not officially supported anymore.

      • Joe Beans

        Thanks… searching for CLSID_NewMenu led me to INewMenuClient which appears to be “documented” and “supported” now but isn’t exactly clear on the usage.

      • W S

        Not the same thing. Ask CLSID_NewMenu for IShellExtInit and IContextMenu.

  • Steven Don

    What is meant by "the first time"? The first time in an Explorer session? The first time in a given folder? The first time during the time the Explorer context menu is open? A simple test I just did implies the latter.
    I admit to getting a little annoyed when I just want to create a new folder and have to wait several seconds for the menu to pop up. Yes, I should probably use...

    Read more
    • Ji Luo

      I always create a new folder with Ctrl+Shift+N… Rarely do I remember using the New context menu these days 🤔
      Raymond: Why doesn’t Explorer employ caching as it does for taskbar toolbars? Plus, Explorer can take SHCNE_ASSOCCHANGED as a hint to invalidate the cache, which, after all, should be sent after any file association data have changed (I consider everything under HCKR\.ext part of file association data).

  • George Gonzalez

    Yeah, every time I wait for that menu to appear, I think:  The first computer I worked on had a 80KHz basic instruction time.  This one runs at 3.2GHz  with six cores.  Two seconds on this one is the equivalent of about two million seconds on that first CDC 160A.  That would be like very roughly 23 days to wait for that menu.  Good thing it didn’t have a registry!

    • W S

      The new menu was probably faster on Windows 95 than it is now, back then HKCR did not have that many keys. .NET dramatically increased the number of keys and WinRT has also contributed a bit.

      • cheong00

        Yup. Those were the days when the whole config folder was under 10MB in size, now the SOFTWARE registry file has over 200MB, way bigger than my first harddrive.
        (I know the files in config folder is just only part of the registry, just quote that for size comparison purpose)