Add Defragment Command to Drives’ Context Menu
Since it takes a relatively long time to browse the Windows Control Panel to find the items you are in need of, here is a workaround for one of the items you probably use or should use most, the defragmentation of drives. This guide describes how you use the Windows Registry to add the defragment-command right into the drives’ context menu appearing on right-click.
To do so, open the registry by entering regedit into a Run… prompt. What appears is a window parted into two frames, a large arrangement of directories (keys) on the left and their contents on the right. Browse the following key in the left frame:
Now right-click the shell key, select New > Key and name it runas. Runas (run as…) defines a new entry in the context menu which lets you open a file, in our case a drive, with a certain application. Look at the contents of runas and double-click the (Default)-value. Change it to the name you want to be displayed in the menu, e.g. Defragment Drive.
Now right-click the created runas-key and create another key inside of that, call it Command. The value inside of that key determines which action should be run upon using the option.
Now you basically could enter any command you can enter in a Windows command line. For defragmentation, the command is defrag followed by the drive and a number of possible switches. To look up which switches are possible, enter defrag -? into a command line. The switch characters are then added to the command lead by a hyphen, as the question-mark before. I think defrag %1 -Uv is basically a good option, so I change the (Default)-value to defrag %1 -Uv. After that, close the registry and right-click a drive and use your newly created defragment-command: