First, open a regular file folder (C: will do just fine).
Second, click Tools, Folder Options...
Go to the File Types tab.
Scroll down to Folder if you want it to appear in the right-click menu of all folders (Control Panel, C:, Scheduled Tasks, My Computer...) or File Folder if you want it to appear on only the places you can store files (C:\, C:\Windows\System, C:\Program Files...). Select Folder or File Folder (see below for some suggestions) and click edit.
Under Action, Name it. Use the ampersand (&) to indicate what letter should be underlined and used as a keyboard shortcut. Use two ampersands (&&) to display a single ampersand.
Under Application used to perform action, type in the command used to do whatever you want to do. Click ok, then close twice and try it out.
Here are some examples:
Dos Prompt Here (Win9x/ME, use on file folder):
Action: DOS &Prompt Here
App used: C:\Windows\command.com /k /cd "%1"
Explore from here (Folder):
Action: Exp&lore From Here
App used: C:\Windows\explorer.exe /root, "%1"
EDIT: the App used for explore from here should be c:\windows\explorer.exe /e, /root, "%1"
If you want to set Explore as your default instead of Open for folders, in file types, select Folder and click Edit. Select explore and choose Set Default. Explore will now be bold.
If you hate the file types dialog and would rather edit the registry manually, here are the keys to edit:
File Folder: HKEY_CLASSES_ROOT\Directory\shell
Look at the existing commands to see how it's done.
Feedback received on this FAQ entry: