Add Defragment Now to the right-click menu
Defragmenting the hard drives of your computer is important on PC systems where programs are installed and uninstalled frequently, or where other read and write operations of files are handled regularly. This can be for instance the case on a drive that is used to save P2P files.
In a perfect world, files would be written contiguously on the hard drive. In the world of Windows they are not, at least not all of the time. Think of the hard drive as a list of blocks that you can fill with data. When the hard drive is new, files can be written in a single block on the drive, but once files get deleted regularly, blocks of different sizes for write operations appear. It then happens that a block is not large enough to contain a file that needs to be written on the hard drive. That's when the contents of the file are split among multiple blocks, and that is what is called fragmentation.
Defragmentation resolves those issues by merging files together again on the hard drive so that the hard drive does not need to jump around to load the file.
I'm lazy. I do not want to right-click the drive, select Properties, change to the Tools tab and click on Defragment Now. Fortunately for users like me there is a workaround that adds the option to defragment your hard drive to the right-click menu of all connected hard drives and partitions.
To make this change, all that is needed is to add a single key to the Windows registry. Once done, the new option appears whenever you right-click a drive in Windows Explorer.
- Open your Registry in the following way: Use the Windows-R key to open the run box, type regedit in the box that opens up and hit the enter key.
- Navigate to the key HKEY_CLASSES_ROOT\Drive\shell using the folder structure on the left.
- If the shell key is missing create it by right-clicking on Drive and selecting NEW > KEY and enter the name shell.
- Create a subkey the same way and name it defragnow.
- Double-click the default value on the left side and add a name for the command that will appear in the right-click menu, defrag for instance.
- Right-click on defragnow and create a new subkey called command. Double-Click the Default entry on the left side again and enter the following value: defrag.exe %1 -v
Once done close the registry and right-click a drive to see if the new option defrag appears. If it does test it with a left-click on the option. A new window should appear on the screen and the defragmentation of the drive should start automatically.
Update: Defragmentation is automatically scheduled on Windows 7 and newer versions of the Windows operating system so that you do not need to run manual runs anymore.Advertisement