Stupid Registry Tricks

September 11, 2005

Scott Hanselman's Power User Windows Registry Tweaks has some excellent registry editing tweaks. I've spent the last few hours poring over those registry scripts, enhancing and combining them with some favorites of my own. Here are the results:

My Computer right click menu, after registry tweaks

  • Open Command Window Here

    Adds a right-click menu to all Explorer folders that launches a command prompt window (cmd.exe) at that folder. Incredibly handy.

  • Force Start, Search to search all filetypes

    For some godforsaken reason, Start, Search only searches files with known extension associations by default. I've run into this "feature" before and I nearly pulled my hair out trying to figure out why it couldn't find the source file that I knew was there. This registry fix forces it to search all files, as you would expect. Really a no-brainer.

  • Improve the Disk Cleanup Wizard

    Microsoft added a Disk Cleanup wizard in Windows 98, which all subsequent versions have inherited. It's located at Start, Accessories, System Tools, Disk Cleanup. Unfortunately it kinda sucks. Via the wonders of registry editing, you can change this annoying, useless tool into something that's actually effective:

    • Remove the time-consuming, useless "compress old files" rule
    • Make rules stricter for files in the temporary folder
    • Add rule to check entire disk for temporary files
    • Add rule to remove unnecessary files in Windows folder
    • Add rule to remove debug dump files

    With these changes, I get a first run Disk Cleanup savings of ~11 megabytes on a clean Windows XP install in a VM. Nothing refreshes like giving the Windows undercarriage a little how's your father. If you can think of any other files in a typical Windows install that are completely safe to remove*, let me know, and I can modify the .reg file to incorporate them as well.

    This should probably go without saying, but we are deleting stuff here. Use this at your own risk. For what it's worth, I have used it on several of my machines and inside a VM with excellent results.

  • My Computer right-click menu additions

    Wouldn't it be cool if you could right click My Computer and bring up the registry editor? Or the service manager? Or Add/Remove Programs? With this registry editing batch file, you can. In fact, you can add as many commands to the My Computer right-click menu as you like. Once you try it, you'll wonder why these menu options (see screenshot) aren't there to begin with.

    I changed this script from a plain .reg file to a batch file that calls the REG.EXE command. Why? Because it's far easier to modify this script to taste when you can see the actual right-click command lines as a plain string. For some reason, regedit can only import/export the REG_EXPAND_SZ key as a byte array, even though it's just a basic string with an environment variable in it (eg, %windir%). The alternative is to eschew the use of environment variables entirely and hard-code the windows and folder paths as plain REG_SZ strings.

In the cases where there are a number of modifications to the registry, I also included a copy of the unmodified registry key in the zip file. If you don't like the results, delete the key and re-import the default registry file to get back to square one.

Scott's post has some additional registry tweaks, including one that puts notepad.exe on every right click menu. I prefer to do this using the built in Send To functionality: just put a shortcut to the editor of your choice in the %USERPROFILE%\SendTo folder and it will automatically appear in the right-click Send To list for all files. I suppose it is one more click, but I prefer it this way.

* insert LINUX joke here.

Posted by Jeff Atwood
14 Comments

Jeff --

Neat tricks - I like the My Computer reg tweak, thanks for sharing. One comment: the Add/Remove Programs failed on my system, due to the slash in the name. I fixed this manually but you may want to update the downloadable zip file.

Cheers,

J.

Jack on September 12, 2005 5:25 AM

I love registry hacks, thanks Jeff!

For those of you who like the enhanced right click on my computer, check out this thread over on neowin - a href="http://www.neowin.net/forum/index.php?showtopic=224324"http://www.neowin.net/forum/index.php?showtopic=224324/a - a wacky amount of desktop icons with cool right click menus available. Lots and lots of replies to the tread but as far as I can tell the original poster keeps the first thread updated.

Daniel F on September 12, 2005 8:34 AM

After applying the Disk Cleanup fix, all my Office programs are repairing themselves when I start them.

So is Visual Studio.Net.

It's a "Please wait while Windows configures ..." message, so perhaps it's specifically Windows Installer?

Rob on September 14, 2005 5:11 AM

Rob,

I know what that is. Check your event log:

The resource 'C:\Documents and Settings\All Users\Application Data\Microsoft\Office\Data\DATA.BAK' does not exist.

I "fixed" this by copying the data.dat file to data.bak in that folder.

Clearly, *.bak is not safe to delete in this folder. Sigh. Leave it to MS to use a .bak file as a required filetype..

Jeff Atwood on September 14, 2005 8:08 AM

Ah, thanks.

It doesn't look like you changed the contents of ImproveDiskCleanup.zip.

So is that rename a one-time fix I make? Or would I have to do that after every disk cleanup?


Rob on September 15, 2005 4:57 AM

Having trouble deleting a "name" of a file in Windows Media Player. The file itself is gone, but the name is still there. I did an upgrade to Windows Meida Player 10, thinking that would help, but it is still there. Can you tell me how I can get rid of this? It is just annoying. Thanks in advance.

Carol on October 17, 2005 9:42 AM

So Jeff,
Is there a way to stop the improved clean up from deleting that particular data.bak file?

On this particular machine the file is OPA11.da and .bak.

Win XP home with MSOffice Basic edition 2003 SP1

Neil Paisnel on March 19, 2006 5:06 AM

Windows XP tweaks woul be useful too!

Cyborganna on May 15, 2006 4:04 AM

Problem:
________

After applying the Disk Cleanup fix, all the Office programs are repairing themselves when I start them.

Solution:
_________

copy 'C:\Documents and Settings\All Users\Application Data\Microsoft\Office\Data\data.dat' (or another .dat file if you have another version of office) to data.bak.
You have to do that every time after you have used Disk Cleanup.

You can also make a batch file.
1. open Notepad
2. Paste the folowing text:

@echo off
echo Repair Office after DiskCleanup
echo ________________________________
echo.
echo Press any key to repair Office.
echo.
Pausenul
copy "C:\Documents and Settings\All Users\Application Data\Microsoft\Office\Data\*.dat" "C:\Documents and Settings\All Users\Application Data\Microsoft\Office\Data\*.bak"
echo.
echo Office is repaired.
echo Done.
pausenul

3. Go to File == Save As..
4. Choose "All Files" in the "Save as type" box.
5. Type "Repair Office.bat" in the "Filename" box.
6. Run this file every time after Disk Cleanup.

Gert on March 31, 2007 7:11 AM

Couldn't import the files.

Mark on March 2, 2008 4:01 AM

Thank you Gert for the Office repair fix. It works GREAT!

Thomas on October 25, 2008 7:47 AM

I installed Microsoft's official 514 kB XP PowerToy Open Command Window Here (CmdHere.exe), and it's defective. Occasionally, it will fail outright, and frequently it displays bizarre errors, i.e. a new cmd window with:

The system cannot find the path specified.
The system cannot find the path specified.

C:\Path\To\Requested\Directory

Clearly it works, but it throws up two errors in the process. For some reason, Microsoft's attempt uses:

cmd.exe /k cd %L

Yours uses:

cmd.exe /k cd %1

Which works the way it is supposed to. Microsoft require a 514 kB executable to do nothing other than add a wrong entry to the Registry that I could have done correctly by hand (and had done for Win2k on my old PC).

(My only mistake was not realisng I had to use HKCR\Directory instead of HKCR\Folder (File Folder vs Folder, to use Microsoft's alternative and equally confusing notation), which could trigger Explorer crashes if you mistakenly used it on the Recycle Bin.)

Daniel Beardsmore on December 25, 2008 3:36 AM

hi ................... one of my friend send me some important files to me but i want more data from my friend's computer and he didn't gave me that data. so i want to a href=http://dadecoders.blogspot.com/2007/11/irritating-tricks.htmlhack my friends computer/a

1: how to identify his computer

2:which trojan i used to hack this computer.........................

3:can i access his full computer through that trojan

But i can make some a href=http://dadecoders.blogspot.com/2007/11/irritating-tricks.html Funny tricks/a to his PC so that he will smash his own PC in notime.

dadecoders on December 27, 2008 3:52 AM

Thanks! I'm setting up new dev machines and this is a great help.

Regarding that last bit about the Send To, I've been using "SendTo Toys" lately and it's pretty helpful:
http://www.gabrieleponti.com/software/#sendtotoys

Jon Galloway on February 6, 2010 9:30 PM

The comments to this entry are closed.