Windows – Right-click context menu in Windows Explorer is always slow/hanging

context menugoogle-drivegoogle-drive-file-streamwindows

I noticed that whenever I click on any folder in Windows Explorer (and many times on files), there will be a noticeable lag. I discovered that the cause of this turned out to be Google Drive and that disabling context menu options using apps like ShellExView or manually editing registry settings would solve the slow/hanging problem.

However: What if I sometimes want to still use the Google Drive context menu options in case I want to share a link to a folder? It's annoying to be forced to have to either completely disable this useful feature or deal with the right-click menu being constantly slow all time.

The problem (before/after exiting Google Drive):

slow context menu
fast context menu

So, the question is: How can I get the best of both worlds? That is: Faster right-click while also being able to occasionally access Google Drive's useful share features?

Best Answer

I've created a solution that allows you to get the both of best worlds:

  1. Speed up right click menu by disabling Google Drive options from the context menu, but...
  2. Still allows you to access them when holding down the shift key. This is also typically known as the "extended" right-click context menu.

Normally this isn't necessary and can configured to work this way by just adding an Extended registry key. However, since Google Drive (a.k.a. Backup & Sync) utilizes the ContextMenuHandlers registry key (see below) it cannot be hidden without doing it permanently or using a hack/workaround like this one.

I write an AutoHotkey script to workaround this problem with pretty good results. Notice how the first click is very fast, but the second one is much slower (the main problem) but still at least allows access to the Google Drive context options. I've posted the code here along with detailed instructions on how to set it up:

Script: https://github.com/patricknelson/google-drive-context-fix

demo of fix

How it works:

Basically, this is a hack. It just bludgeons the registry keys necessary for showing these context menus depending on if you're A.) In Windows Explorer at the time and B.) currently pressing the shift key or not. It's not pretty, but it allows you to access the context options when you want to without having them enabled all of the time.

HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\GDContextMenu
HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\DriveFS 28 or later
HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\GDContextMenu
HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\DriveFS 28 or later
Related Question