Add Defragment to Context Menu for Drives in Windows 8

It is essential for faster and healthy hard disks that you defragment the contents of disks once in a while. If your hard disks become fragmented, then it may increase the disk access time and consequently can make Windows to take a little longer time to respond. You can defragment the hard disks from the Control Panel in Windows 8. But if you want to save time, then you can add the Defragment option in the right-click context-menu of the disk drives in File Explorer. Here is how :

Add Defragment to Context Menu for Drives in Windows 8

  1. Press Windows logo key + R. In the Run dialog, type regedit and press Enter.
  2. In the Registry Editor window navigate to the following registry key :
    HKEY_CLASSES_ROOT\Drive\shell
  3. Right-click on shell and choose New → Key. Then type runas as the name of the new key and press Enter. Select the newly created runas key. Double-click on (Default) in the right-side panel and change its value to Defragment.

    Add Defragment to Context Menu for Drives in Windows 8

  4. Right-click on runas and choose New → Key. Then type command as the name of the new key and press Enter. Select the newly created command key. Double-click on (Default) in the right-side panel and change its value to defrag %1 -v.

    Add Defragment to Context Menu for Drives in Windows 8

  5. That’s it. You have just added the defragment option to the right-click context-menu for all the hard disk drives in the File Explorer of Windows 8.

If you do not want to go through all these steps, then you can just download the registry script win8_defrag_context_menu.zip. Extract the contents of the ZIP file to a folder and then double-click on Add_Defrag_Menu.reg to add the defragment context menu. If later you decide to remove this context menu, then you can double-click on Remove_Defrag_Menu.reg file.