Actually the above isn't entirely accurate, as far as Windows 2000 goes, and I'd imagine for 95 and 98 as well (though I haven't checked).
First up, the cmd command (ahem) doesn't actually accept a path as a parameter. cmd %1 does nothing. But why does it work then? Because if you right click a folder in windows explorer's folder list (the left hand pane) the environment variable saying what the current path is changes to that folder. The cmd prog loads in this 'current folder' as stored in the environment by default so the path seems to be correct. However, this does NOT work if you click a folder in a listview (ie the right hand pane of windows explorer), because the folder is only highlighted, but the environment doesn't change to that folder. Instead the command prompt window will load up in the folder that CONTAINS the folder you clicked, as this is the 'current' folder.
So what can we do about this? Well, cmd DOES in fact allow you to run commands just after instantiation. Specifically, append: "/k Horses" to cmd, where Horses is some command, and away it goes. So to make this work we put:
cmd /k "cd %1"
cd is the command prompt command for Change Directory.
Note that the command string is in quotes. This isn't strictly necessary, but I feel it makes the whole thing neater.
OK, that works, but we can improve it a bit. If I use my "Command Prompt" option (I prefer Command Prompt to DOS Prompt) on "Program Files", then it comes up in
C:\PROGRA~1>
Ugly. So instead of %1, I'll use %L which, of course, passes the path in long filename format:
cmd /k "cd %L"
gives...
C:\Program Files>
OK, what about Drives? It'd be handy to do the same thing with drives too right? We have two options:
(1) - put our little menu command in the HKCR/Folder key
(2) - put an identical menu command in the HKCR/Drive key
I'm going for Option (2). This is because windows also considers things like the control panel to be folders too, and %L (and %1) don't return paths for these things (which makes sense). This would cause issues, so instead we'll just make a copy in the Drive key.
OK, more fun:
You can put more than one command after the /k - so what about having it list the contents of the dir? Well commands are separated by a pair of ampersands (&&), so the new line goes like this:
cmd /K "cd %L&&dir"
or better still:
cmd /K "cd %L&&dir/w/o/p"
...which adds the parameters to dir to make the list Wide, sOrted and appear Page at a time (with "Press a key..." messages).
I'll leave you to consider the possibilities from here. Here's a standard .REG file with the final above changes. Just copy and paste into a new text file called "whatever.REG", double click, and enjoy. Note that this may not work on earlier versions of windows, you may need to change the 'Version' value to get it going on Win 9x. Also the usual disclaimers apply.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Drive\shell\cmdprmpt]
@="Command Prompt"
[HKEY_CLASSES_ROOT\Drive\shell\cmdprmpt\command]
@="cmd /K \"cd %L&&dir/w/o/p\""
[HKEY_CLASSES_ROOT\Directory\shell\cmdprmpt]
@="Command Prompt"
[HKEY_CLASSES_ROOT\Directory\shell\cmdprmpt\command]
@="cmd /K \"cd %L&&dir/w/o/p\""