How-To Geek

Add Disk Cleanup to the Right-Click Menu for a Drive

The registry hack for this article comes to us courtesy of jd2066, one of our helpful forum members.

Normally when you want to access the Disk Cleanup tool, you usually have to either find it through the start menu, or open up the drive properties window. Instead of going through all that, we can use a simple registry hack to add a menu item to the drive right-click menu.

Using the Hack

After installation, you can simply right-click on a drive and choose “Disk Cleanup” from the menu:


If you are using Windows 7 or Vista, you’ll be asked whether you want to clean up your files or all files…


And then disk cleanup will begin:


Manual Registry Hack

Open up regedit through the start menu search or run box, and then browse down to the following key:



Create a new key called “diskcleanup” and set the default value to “Disk Cleanup”. Then create another key underneath it called “command” and set the value to the following:

cleanmgr.exe /d %1

The change should be immediate, just right-click on the drive and you should see the new menu item.

Downloadable Registry Hack

Simply download, extract, and double-click on DiskCleanupDriveMenu.reg to enter the information into the registry. You can use the included RemoveDiskCleanupDriveMenu.reg file to reverse the changes.

Download DiskCleanupDriveMenu Registry Hack

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 06/19/08

Comments (21)

  1. Lighthouse

    Just one point. If you do as is shown above, you will have “diskcleanup” shown on your context menu, not the neater looking “Disk Cleanup”
    So for for the first key, enter “Disk Cleanup” (without the quotes)

  2. The Geek

    Actually, if you set the default value of that key it will be named correctly… I just didn’t show that step in the screenshot. =)

  3. Lighthouse

    doh!…here’s me being minimalist again :)

  4. Chris

    Can you do one for Defrag the same way?

  5. USBman


    I’ve been working on that very thing, actually. …however, my efforts haven’t been met with any success (not yet, anyhow).

    So far I’ve followed the same instructions outlined above, expect I’ve instead replaced the command with “defrag %1 -v -w” (w/o the quotes). (for command line usage, run an administrator command prompt and type “defrag -h”) …needless to say, that doesn’t work. a command prompt window pops up and immediately disappears.

    I can think of two things this might be due to: 1) defrag from the command prompt requires admin privilege authorization, and this method doesn’t offer any chance to give it 2) maybe the “%1” input doesn’t work. Does anyone have any ideas? I’d love for this to work – all your tool available in one easy right click!

  6. beep54

    I have come to view ‘Disk Cleanup’ in Vista as malware. For reasons only possibly known by Microsoft, I have found that it will report erroneous findings for my external disks. Sure, one expects Vista to generate a rather large amount of error reports, but really, that file should not be larger than the size of all the files actually on the disk by a factor of 4 of so. :) If you DO try and use disk cleanup for one of those unfortunate disks, it will simply attempt to erase absolutely everything on the poor disk and you will then have a nice shiney blank hard drive when it is done.While this does not happen in XP, I can replicate this behaviour on my Vista machine at will.

  7. beep54

    BTW has any one else experienced this goofiness with Disk Cleanup?

  8. Lighthouse

    @beep54. This problem seems to have been solved with SP1. If you know otherwise, please feel free to email me.

  9. Michael Higham

    Thanks! It worked for me.

  10. Jesper Ginge

    Does this also work on XP

  11. David

    Just use CCleaner; it’s vastly better anyway.

  12. pixlez3n

    Thanks Geek… works great and very helpful.
    Keep those ideas coming our way!

  13. SNOOZE

    the amount of space i have on my disk seems to be spiralling downwards and yet i AM CONVINCED I HAVE less on my pc than ever-i get the feeling the indicator does not pick up on all that is deleted.For over a year I went along happily showing 10-12gb as being available-recently this has dived to 6.4 average.

  14. Ripley

    not sure why exactly, but on my system (vista home premium), the command switch needs to be
    ” -d%1″ (no quotes; space between cleanmgr.exe & the dash included). “/d%1” resulted in an error message. ah, vista; oh, microsoft….

  15. data_dude360

    You can do the same for another program (like CCleaner, or Defraggler) but in command, type the location of the item.

  16. robmaister12

    Hey, just tried this, but because I am on a laptop, when I remove Hibernation Files, it also disables hibernation on my laptop, so I have to go back to CMD and enter “powercfg /hibernate on” (without quotes) to let my laptop hibernate again… Is there any way to add a second command to do this automatically after disk cleanup closes?

  17. Jakir Hussain

    Thanks for this information

  18. Rishabh

    Great Man. Worked fine

  19. Michael

    I have a computer question. I have windows 7. How do I recover the “Disk Cleanup” icon in Windows 7 if I deleted it (oops!) off “Start Menu”? Or he program has disappered from my “start menu”, because I deleted it. Thanks! Michael

  20. knan

    Thank you for wonderful info. It worked for me.
    But can someone explain the syntax to me and where I can get that information.
    What does /d and %1 stand for.

  21. Michael Higham

    On the Start menu, click Run, type cleanmgr /d and then press ENTER.
    For example, if you want to use Disk Cleanup on drive C, you would type cleanmgr /d c: and press ENTER.

More Articles You Might Like

Enter Your Email Here to Get Access for Free:

Go check your email!