Adding Desktop Context Menu Entries in Vista
I like to think of myself as something of a power user when it comes to Microsoft Operating Systems in general. I should be, after 25 years of messing around with every new version except Millenium. I don't think they'll ever live that one down out in Redmond, and I personally don't think they should be allowed to live it down, ever. Ugh.
But I like to tweak. It's in my nature. I had Vista for all of two hours when I disabled UAC, but that was a matter more of necessity than anything else. It wouldn't let me install Apache or muck around with my classpath, which was both buggy and irritating. Of course, once UAC was dead, Apache installed just fine, and the world was a happy place in Anthony-land.
A little background on this tip: I spend a lot of time on remote servers. I get used to the way things are typically set up and organized, and I want windows to behave itself appropriate to the environment that pays my bills. When you Putty into a server to change system level settings, recompile a PHP distro, whatever the case may be, you're not faced with the same command line syntax or directory structure ("folder structure", if you wanna be like that) that you see in Windows. In Windows, you see something like:
c:\Program Files\Apache Group\....
and in *nix, it's more like
/usr/sbin/.....
So when I want to get into the conf/ directory for a website on the server, the commands look like this:
cd /var/www/vhosts/domain_name/conf
vim httpd.conf
And by default, Apache on Windows installed the htdocs folder and configured me up to:
c:\program files\Apache Foundation\Apache....\htdocs
Which made me keep doing mental gymnastics and wondering where I was, since I run just about everything on the command line. I came up with a solution that is likely to irritate the sensibilities of some people, since it means editing the dreaded registry... da da dummmmmm
(This tutorial assumes you have admin privileges. If you like, you can turn UAC back on later.)
Seriously, before you do anything in this tutorial, do this:
-
hold down the windows key
-
press "r"
-
type "regedit"
-
Click on "Computer" waaaay up top
-
Click File->Export and follow the command prompts
NOT backing up your registry is just plain irresponsible.
Ok, so now, for my purposes, I wanted to add a new command line window in a certain folder to the context menu for the desktop. First thing is to open regedit, just like we did, or if you're still in there after the export I know you did because you're a smart and thoughtful person, so much the better. Everyone else, open up regedit.
The stuff we're going to mess around with is located in:
-
[HKEY_CLASSES_ROOT\Directory\Background\shell]
Right-click on shell and select New->Key
Name this key something small and simple, don't ad any spaces. I find relevance helps.
In the values side of the window, you see something similar to:
-
Name Type Data
-
Default REG_SZ (value not set)
Double-click on default, and enter a name for the context menu item ("Server Root", in my case).
Click Ok
Ok, so it should look something like this about now:
-
Directory
-
Background
-
shell
-
cmd
-
your_key_name
Right click on your key name (If you entered "paint", then click "paint"), and click New->Key again.
This time, you have to name the key [i]command[/i]
In the values pane on the right hand side, enter the command you want to execute when you click the entry.
So if I want to open a command line with a green background and yellow text open in a new mysql session, I would enter:
cmd.exe /T:2e /K mysql -u root -pmypassword
Or any other valid windows command.
~A!