Modern technology gives us many things.

How to Set Up Disk Defragmenter Context Menu Shortcuts in Windows 11


Keeping your disk defragmented is a good way to keep it running optimally. Here’s how to create a context menu shortcut for the defragmenter tool.

A hard disk

Windows 11 includes a built-in Defragment and Optimize Drives utility (formerly called Disk Defragmenter) for drive optimization. This tool defrags your hard drive by reorganizing fragmented data on it. As a result, it enhances data retrieval efficiency on your PC.

As such, it’s worth defragging your PC’s primary storage drive now and again. You can add alternative disk defragmenter shortcuts to the drive and desktop context menus in Windows 11. Such shortcuts will save you from having to search for the defrag tool. This is how you can set up convenient defragment context menu options in two different ways.

File Explorer’s This PC section includes a C: drive icon you can click to delve into the local disk. That drive icon’s context menu is the perfect place for a Defragment option, but guess what: it doesn’t have one! Nevertheless, you can still add a defrag shortcut to the Local Disk icon’s context menu by editing the registry like this.

  1. Click the search tool’s magnifying glass taskbar icon.
  2. Type Registry Editor in the text box, and click the Run as administrator option for its search result.
  3. Navigate to the HKEY_CLASSES_ROOTDriveshell key within the Registry Editor.
  4. Right-click shell on the left of the Registry Editor to select New > Key.
    The New and Key options
  5. Input the name runas for the new key.
  6. Select the runas key, and double-click its (Default) string.
  7. Enter Defragment in the Edit String’s text box, and click the OK button.
    An Edit String window for the runas key's Default string
  8. Right-click runas and select the New and Key context menu options.
  9. Type command to be the new key’s title.
    A runas key
  10. Click the new command key to select it.
  11. Double-click (Default) on the right side of the Registry Editor.
  12. Enter defrag.exe /u /v %1 in the Edit String’s window Data value box like in the screenshot directly below.
    The Edit String window
  13. Select OK to exit the Edit String window, and close the Registry Editor.


Now it’s time to try out the new Defragment shortcut. Open File Explorer, and click This PC within the left navigation pane. Right-click Local Drive and select the Defragment context menu shortcut shown directly below. Selecting that option will defrag the drive and open a classic command-line window that displays the results.

The Defragment option

This registry tweak also adds a Defragment option to the classic context menu, which means it works for Windows 10. To open the classic context menu for the drive icon in Windows 11 File Explorer, select Local Disk and press the Shift + F10 hotkey. Then you can select Defragment from the classic menu.

The defrag command window

Read also: How to Customize File Explorer in Windows 11

Windows 11’s desktop context menu is another place we can add a shortcut for the Defragment and Optimize Drives tool to. By adding a shortcut there, you’ll be able to access the defrag tool directly from your desktop. This is how you can set up a desktop context menu shortcut that opens the graphical (GUI) Optimize Drives window.

  1. Open the Registry Editor (as administrator).
  2. Open the ComputerHKEY_CLASSES_ROOTDirectoryBackgroundshell key.
  3. Right-click shell to open its context menu and select New > Key.
    The Key option
  4. Give the new key a Disk Defragmenter title.
  5. Right-click Disk Defragmenter to select the New and Key options.
  6. Input command to be the subkey’s title.
    A command subkey for the Disk Defragmenter key
  7. Select the new command subkey, and double-click the (Default) string for it.
  8. Input “C:WindowsSystem32dfrgui.exe” within the Edit String window’s text box as in the screenshot directly below.
    The dfrgui.exe path value
  9. Press the OK button, and close the Registry Editor.

To select the new Disk Defragmenter shortcut, open the classic context menu by right-clicking the Windows 11 desktop and selecting Show more options. Clicking the new Disk Defragmenter option there will open the Optimize Drives window below. There you can select your C: drive and click Optimize to defrag it.

The Optimize Drives window

Read also: How to Add Software Shortcuts to Windows 11’s Desktop Context Menu

Those context menu shortcuts will give you more direct access to the Defragment and Optimize Drives tool in Windows 11. The first method adds a right-click menu option to Explorer’s Local Disk icon that defrags your PC’s C: drive when selected.

If you prefer a shortcut that just opens the Optimize Drives window, without defragging anything, add that option to the desktop context menu as outlined for the second method.

Bronze hard drive disk with dark background
Computer Storage: A Brief History of Storing Your Personal Data

Computer storage has come a long way, and has a fascinating history.

Read Next

About The Author

Source link

Leave A Reply

Your email address will not be published.