MSTechpages
  • Home
  • Knowledge Base
  • Reviews
  • Articles
  • About
Windows 7

Add Defragment to your right click context menu

Oct 17, 2010·Dustin

Sometimes, you want quick access to defragment your hard drives. Well, you can save yourself a few clicks by adding the Defragment command to your right click context menu. This can come in handy (although it does nothing to speed up the defrag process itself).

1. Go to Start, type in regedit and press enter (Or you can go to Start, Accessories, Run and type regedit).

2. Navigate to the key HKEY_CLASSES_ROOTDriveshell.

3. Name it defrag (this name can be anything, really).

4. On the right pane, double click the Default value and name the Value Data field with “Defragment“. This text is going to be what you see when you right click a drive, so it is also custom.

5. Right click on the defrag key that you made earlier and choose New and Key.

6. Name it command.

7. Double click the Default value of this key, and change the Value Data with defrag %1 -v.

8. Now, when you right click a drive, you will have the Defragment command available. It does open a Command prompt to do it’s work.

Related Products on Amazon
USB to SATA AdapterShop on Amazon
DDR3 RAMShop on Amazon
External HDDShop on Amazon
USB Flash DriveShop on Amazon

MSTechPages is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com. As an Amazon Associate, we earn from qualifying purchases at no extra cost to you.

#Defrag #Right Click
Dustin

Dustin is the founder and head editor of MSTechpages. He started the site to help other users of Windows. He has been very active with helping others throughout the years, from USENET to Microsoft Answers to the latest Microsoft Communities as well as other internet forums such as Reddit. He is a Sr. System Administrator, holds several industry certifications and degrees.

Related Articles

Windows 11

Add “End Task” To Right Click Application on Taskbar

Sep 16, 2025·Dustin
Windows 10

Offline install of .Net Framework 3.5 using DISM

Apr 1, 2020·Dustin
Windows 10

Disable Autohide Scrollbars

Jul 8, 2019·Dustin

Windows Insider Builds

Canary
29553.1
Dev
26300.8085
Beta
26220.8079
Release Preview
26100.8106
Recent Knowledge Base Articles
  • Add “End Task” To Right Click Application on Taskbar
  • Offline install of .Net Framework 3.5 using DISM
  • Disable Autohide Scrollbars
  • Install Active Directory RSAT in Windows 10 1809 or later
  • Disable File Grouping in File Explorer
  • Forget Wireless Networks
  • Show Hidden Files & Folders
  • Enable Night Light Mode
  • How to Fix a Network Printer Showing Offline
  • Open a Command Prompt/Powershell Prompt at Folder Location
MSTechpages

Your source for Windows news, tutorials, and Insider builds.

Windows

  • Windows 11
  • Windows Insider
  • Canary Channel
  • Cumulative Updates

Resources

  • Knowledge Base
  • Articles
  • Reviews

Company

  • About
  • Contact
  • Privacy Policy
  • Advertise

© 2026 MSTechpages. All rights reserved.

Privacy