Add the Defrag Option to Right-Click Menu

We have discussed the importance of regular defragging and how this will improve your system performance. This tweak will make defragging slightly easier by adding the option to your right-click menus.

If you want to have the defragment option available when you right-click on a drive, then read on. This tweak is fairly simple and will only take a couple of minutes to implement. You will need to perform a registry edit, so proceed with caution. We never recommend editing the registry and you do so at your own risk.

OK, let's get started.

First you will need to open the Registry Editor. You do this by typing "regedit" into the quick search box.

start regedit

After you have opened the Registry Editor, browse to the following location:


You should see the following:

defrag to menu

Now you need to create a new key in the shell folder. Do this by right-clicking on the shell folder and selecting New->Key. Give the new key (folder) the name "runas". Now double-click on the default value in the "runas" folder and give it the value of "Defragment". This is the value that will appear in the right-click menu.

You need to create a new key under "runas" and call this "command". Right-click on the "runas" folder and select New->Key.

After you have created the command key, you will need to change the default value. Double click on the default key, and enter the following value: "defrag %1 -v". You should now have a key the same as the screenshot below.


That is all you need to do. Now when you right-click on a drive, you will see a defragment option. After choosing defragment, the output will appear in the Windows command prompt.


Just remember to defragment your drives on a regular basis to keep your PC in top shape!