Add Optimize Drives Context Menu in Windows 10

Defrag Icon

Optimizing your PC's internal disk drive is a very important process which improves your PC's performance. In this article, we will see how to add "Optimize Drives" to the drive context menu in Windows 10.

Out of the box, Windows 10 performs disk defragmentation once a week for hard drives and SSD TRIM operation for SSDs. During active use, hard drive performance suffers due to file system fragmentation which notably slows down the access time. SSDs have very fast access times for data stored in any part of the drive and do not need to defragmented but they need to be sent a TRIM command which tells the SSD controller to erase unused blocks which are no longer in use, so that when the time comes to actually write new data to those blocks, performance isn't affected.

Tip: See how to optimize drives by schedule in Windows 10.

Modern Windows versions are smart enough to pick the right optimization method and time period depending on your drive specifications. If you need to optimize drives manually, you may want to add the Optimize drives command to the drive context menu. Here is how it looks:

It opens the following dialog:

This can be done with a simple Registry tweak or using the Context Menu Tuner app. Before proceeding, ensure that your user account has administrative privileges. Now, follow the instructions below.

To add the Optimize Drives context menu in Windows 10, do the following.

  1. Open the Registry Editor app.
  2. Go to the following Registry key.
    HKEY_CLASSES_ROOT\Drive\shell

    See how to go to a Registry key with one click.

  3. Here, create a new subkey named "dfrgui". See the following screenshot:
  4. On the right, create a new string value MUIVerb and set its value data to the line "Optimize drives".
  5. On the right, create a new string parameter named Icon and set its value data to dfrgui.exe.
  6. Under the HKEY_CLASSES_ROOT\Drive\shell\dfrgui key you created, create a new subkey named command as shown below.
  7. Set its default parameter to the line dfrgui.exe. See the following screenshot.
  8. Open File Explorer.
  9. Navigate to the This PC folder.
  10. Right click any drive. You will see your context menu.

To save your time, you can download these ready-to-use Registry files. The undo tweak is included:

Download Registry Files

Add the Optimize Drives context menu with Context Menu Tuner

There is a special Ribbon command "Optimize" which opens the Optimize Drives dialog from This PC. We can add to the context menu.

The easiest way to add any Ribbon command to the context menu is to use Winaero's Context Menu Tuner. It has an easy-to-use interface and will allow you to add any command you want to the right-click menu. The command is called "Windows.Defragment". See the following screenshot:

Do the following.

 

  1. Download Context Menu Tuner.
  2. Select the History command on the left as shown above.
  3. Select "Drive" on the right.
  4. Double click the Windows.Defragment item on the left. It will be added to the drive context menu. See the screenshot:

 

That's it.

Support us

Winaero greatly relies on your support. You can help the site keep bringing you interesting and useful content and software by using these options:

If you like this article, please share it using the buttons below. It won't take a lot from you, but it will help us grow. Thanks for your support!

Author: Sergey Tkachenko

Sergey Tkachenko is a software developer who started Winaero back in 2011. On this blog, Sergey is writing about everything connected to Microsoft, Windows and popular software. Follow him on Telegram, Twitter, and YouTube.

3 thoughts on “Add Optimize Drives Context Menu in Windows 10”

  1. Great tip!!
    Would there be a way to automatically trim the SSD when clicking the “optimize drive” command?
    Ya know, right click on the drive or even a blank space on the desktop and click optimize drives and it sends the command to the pc to trim the drive without any other input from the user?

Leave a Reply

Your email address will not be published.

Exit mobile version
Using Telegram? Subscribe to the blog channel!
Hello. Add your message here.