XP's SP2 registry command regression

Windows Explorer allows you to add new commands to the "right click" menu for file names and directories. One does this in the HKEY_CLASSES_ROOT registry key.

If you wish to add a new command for a particular file extension, you add commands to the subkey for that file extension. If you wish to add a new command for directories, you add commands to the subkey named "Directory" (or to the subkey named "Folder", if you prefer the Microsoft word for a directory). Here is a stupid example, of adding a program named "mycmd" to the right click menu of a directory.

[HKEY_CLASSES_ROOT\Directory\shell\mycmd]
@="This is the name of my command"

[HKEY_CLASSES_ROOT\Directory\shell\mycmd\command]
@="mycmd.exe"

In all versions of Windows prior to XP SP2, as long as "mycmd.exe" was findable via the PATH environment variable (settable via the System Control Panel applet), this worked great.

The problem

Update to SP2, and it stops. Choosing "This is the name of my command" from the popup menu suddenly begins taking you to an "open with..." dialog!

The cause

After quite a bit of head scratching, and a bit of fruitless internet searching, I gave up on this problem for a while, and went back to using a batch file to do special commands. Then one day, I found a special command that still worked after upgrading a machine to SP2, and took a look at the differences. The command that worked had a fully qualified path name.

The solution

[HKEY_CLASSES_ROOT\Directory\shell\mycmd]
@="This is the name of my command"

[HKEY_CLASSES_ROOT\Directory\shell\mycmd\command]
@="c:\\program files\\mydir\\mycmd.exe"

Fully qualifying the path to the program makes it work. It is not clear what "bug" MS fixed that caused them to quit searching the PATH for commands in the registry, but it certainly appears that they quit doing such searches.

Thanks, Microsoft, for another undocumented, incompatible change to the way Windows works. Without such, productivity would probably soar!