Add Optimize Drives Context Menu in Windows 10

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:Optimize Drives Context Menu

It opens the following dialog:Optimize Drives Window

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.

    See how to go to a Registry key with one click.Shell Key For Drives

  3. Here, create a new subkey named "dfrgui". See the following screenshot:
    Shell Create New Key For DrivesShell Create Dfrgui Key
  4. On the right, create a new string value MUIVerb and set its value data to the line "Optimize drives".Set Name For Key
  5. On the right, create a new string parameter named Icon and set its value data to dfrgui.exe.Create Icon Value For Optimize Drives Command
  6. Under the HKEY_CLASSES_ROOT\Drive\shell\dfrgui key you created, create a new subkey named command as shown below.Command Key
  7. Set its default parameter to the line dfrgui.exe. See the following screenshot.Set The Command Key Default Value
  8. Open File Explorer.
  9. Navigate to the This PC folder.
  10. Right click any drive. You will see your context menu.Optimize Drives 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:

Context Menu Tuner Defrag Command

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:Context Menu Tuner Add Optimize Drives Context Menu Tuner Added Optimize


That's it.

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

  1. Alicia

    I REALLY need this! I’m going to kiss you

    1. Sergey Tkachenko Post author

      Sounds not bad :-)

  2. Gerald Kellerbauer

    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. Required fields are marked *