Tech Tips Home
The Best Tech Tips And Daily Deals
Newsletter On The Internet!

WorldStart Tech Tip And Store Search
Email: Password: Login Remember Me

Like what you see here? Subscribe to the Tech Tips newsletter!   Email: Subscribe

Add Defragment to the Right Click Context Menu

Monday, March 7th, 2011 by | Filed Under: Shortcuts & Keyboard Tricks, System Tune-Up Help

Kaleen writes:

I really try to take care of my computer and use defragment a lot. I don’t know if it’s possible, but can I add it to the right-click menu? I use Vista.

First let me say that I think it’s awesome that you defragment your computer a lot. One of the things I learned when I got my first computer was to defragment, and it was great advice.

Yes, you can add defragment to your right-click (context) menu. It does involve editing the registry a little, so make sure you back up your registry before you start. Things that happen in the registry cannot be undone and can wreak total havoc your system. Click here to learn how to back up your registry.

Note: If you would like to learn more on navigating the registry, click here.

Make sure you go through this with me exactly, that way you won’t make your computer upset and you a basket-case. But, since you started by backing up the registry, if you do make a mistake, you have a way to restore your original settings. Which you won’t do, because I won’t let you! Here we go:

The first thing you always do when you are going to edit the registry is left-click on your Start menu, and then go to your Run line. If you have the regular Start menu enabled, then you will see the Run line at the bottom of the right-hand side. If your start menu doesn’t show the Run line, click here for an article on how to add it to the menu. If you have the Classic menu enabled, then the Run line should appear above your Shut down option in the Start menu, right above the Start button.

To access Run in with the regular Start menu:

To access Run with the Classic menu:

Note: After you have accessed Run, everything is the same in both menus.

If you would rather use a keyboard shortcut, just type Win + R (Win being your Windows key) and your Run box will pop up.

After you have left-clicked on Run, a text box will appear next to it. Type regedit in the box (to the right of Open) and left-click on OK.

One final way to get to the registry editor is to type regedit into the Search box, wait a second, and then regedit.exe will appear at the very top. Left-click on it to open it.

You are now looking at your Registry Editor.

What we are going to do now is navigate to the place where we want to edit the registry. This is where we want to navigate to:


You will see that the editor has two panes. In the left pane, you will see Computer, and under it, you will see HKEY_CLASSES_ROOT. Left-click on that to highlight it, and then point your cursor at the little plus sign to the left and left-click on it to expand a drop-down menu.

After you click on the little plus sign, a new menu will drop down. Go down the menu until you see Drive and then left-click on the little plus-sign next to that.

A menu will drop down again. Go down the list until you see shell. Left-click on it to highlight it.

Now we’re going to edit the registry; this time we will be working in the right pane, as well as the left pane.

The first thing we’re going to do is right-click on shell. On the menu that pops up, point your cursor on New to highlight it, and then left-click on Key.

A place to name the key will appear in the left pane. We have to name the key, so in the area to the left that is now highlighted, type in runas.

After we create the runas key, we need to change the Default value (right pane) and name it Defragment. To change the default value, right-click the Default key and then left-click on Modify. A text box will pop up; type Defragment in it, then left-click on OK.

Whew! Seems like it’ll never end, huh? We’re almost done.

Now we’re going to create the final key. Right-click runas, point your cursor at New to highlight it, and then left-click on Key. When the text box pops up, so that you can name it, type command in the box.

Then name the key command:

As we did before, we have to change the Default value. Right-click on Default and then left-click on Modify. In the text box that pops up, type this in:

defrag %1 –v

Left-click on OK.

Close out the Registry Editor.

To see the final result, go to My Computer and left-click, and then right-click on your hard drive (the C: drive).

Here’s the before and after.

Now no more left-clicking and left-clicking and pointing to Accessories and and and … Now you can just right-click to defragment your hard drive whenever you feel like it. And that’s a good thing!

Thanks for writing, Kaleen!

~ Lori Cline

Tags: ,

3 Responses to “Add Defragment to the Right Click Context Menu”

  1. dottie says:

    Great tip. Makes things so much easier for those who want to do this everyday and keep their computer running smoothly

  2. John Sietsma says:

    Wow: that is a lot of work to set up.
    Being lazy, I use the free Smart Defrag program that runs in the background without taking up many resources and defragments any files that need it when your PC is not being used. So your PC is just about fragment free all the time. Easy and effective!

  3. Bill R TechSpec says:

    You are to be commended for a very thorough article — it’s fun to learn about all the cool mods you can make on your PC. Thanks for sharing this info and for supplying so much detail — I can think of numerous things this procedure could be applied to! Personally, as far as defragmenting goes, I’m with John on this one, except that I use Diskeeper to defrag my disks, as it’s automatic, it works in the background with no impact on system resources and it actually prevents fragmentation from occurring in the first place.

Leave a Reply

Like these tips? Get them for FREE in your email!

WorldStart's Tech Tips Newsletter

  • Tech Tips Daily - Become a tech pro! Get the very best tech and computer help sent directly to your email every weekday!

  • Tech Tips Weekly - If you don't want our Tech Tips newsletter every day, then sign up for this weekly newsletter to get the best information of the week. Sent on Fridays.

Other Newsletters

  • WorldStart's Daily Deals - Every week, we send out great deals in our Daily Deals newsletter. Many of these deals are exclusively for our Daily Deals newsletter subscribers and can't be found with our regular specials.

  • Just For Grins - Each issue includes a couple clean jokes, some funny quotes, and a hilarious reader's story. Newsletter is sent five days a week.

Enter Email Address:


Your e-mail address is safe with us!
We only use it to send you the newsletters you request. It is NEVER disclosed to a third party for any reason, ever! Plus, if you decided you don't like our newsletters (don't worry, you'll love them), unsubscribing is fast and easy.

Free Newsletter Signup

Tech Tips Daily

Become a tech pro! Get the very best tech and computer help sent directly to your email every weekday!

Tech Tips Weekly

The week's best in tech and computer help. Get your issue sent to your email every Friday!

WorldStart's Daily Deals

The very best deals on the Internet! Get a new set of incredible sales every day of the week!

Just For Grins

Clean jokes, funny quotes, and hilarious comics. Sent 5 times a week straight to your email.


Love Worldstart? Refer A Friend!

WorldStart's Premium Membership

Tip Archive