28

Sorry if this has been asked before, I've been looking around and it's hard to find what I want.

I know how to add a context menu item to a folder like so:

[HKEY_CLASSES_ROOT\Folder\shell\console2]
@="Open Console2 Here"

[HKEY_CLASSES_ROOT\Folder\shell\console2\command]
@="C:\\Program Files\\Console\\console.exe -d \"\"%1\"\""

but, that only works for right clicking on a folder. I want it so that you can be inside the folder, and click a blank part of that folder and get the context menu item as well. I also tried HKEY_CLASSES_ROOT\Directory\shell as well, but it does the same.

dreftymac
  • 31,404
  • 26
  • 119
  • 182
user380527
  • 1,607
  • 2
  • 17
  • 20

8 Answers8

50

I figured out the answer. The folder is actually Directory\Background, you have to add the empty string value of NoWorkingDirectory into it, and the %1 in the command becomes a %V

[HKEY_CLASSES_ROOT\Directory\Background\shell\console2]
@="Open Console2 Here"
"NoWorkingDirectory"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\console2\command]
@="C:\\Program Files\\Console\\console.exe -d \"\"%V\"\""

Source: saviert's comment at http://www.howtogeek.com/howto/windows-vista/make-command-prompt-here-always-display-for-folders-in-windows-vista#comment-57856

user380527
  • 1,607
  • 2
  • 17
  • 20
  • 4
    Just FYI: this doesn't work on XP. That registry key only works for Vista and later OS. – Stefan Feb 06 '11 at 08:06
  • Does anyone know how to make this work on xp? a cross platform option would be best but I'll take what I can get. – Robert Jun 24 '11 at 12:31
  • For anyone entering this via the regedit util the command value should have single slashes and only quotes around the %V. Looking something like this depending on your path `C:\Program Files (x86)\Console2\Console.exe -d "%V"` – gingerbreadboy Aug 23 '13 at 14:59
  • This works fine for XP as long depending on the editor you use and the whether you are using the `regEdit4` or `regedit5` format (follow @gingerbreadboy's instruction regarding the single slasheds). Here's a guide from Microsoft: http://support.microsoft.com/kb/310516 – Flak DiNenno Dec 24 '13 at 23:06
  • @FlakDiNenno Stefan refers to registry key did not create a context menu entry not that `regedit` is rejecting you from creating it. – Skip R Jul 26 '16 at 22:26
4

Console2 rocks. I added an 'Cmd here (Console2)' item to my explorer context menu.

enter image description here

Save the text below in a file named open-console2.reg then open it to import it to the Windows registry.

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\console2]
@="Cmd here (Console2)"
"NoWorkingDirectory"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\console2\command]
@="\"C:\\Program Files (x86)\\Console2\\Console.exe\" -d \"%V\"\\"

Bonus 'bash here' item (assumes you have a Console2 tab named 'bash').

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\console2_bash]
@="Bash here (Console2)"
"NoWorkingDirectory"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\console2_bash\command]
@="\"C:\\Program Files (x86)\\Console2\\Console.exe\" -t Bash -d \"%V\"\\"
Colonel Panic
  • 132,665
  • 89
  • 401
  • 465
  • why i can import this? it stated u can only import binary registry file from registry editor? maybe related to character encoding? – slier Oct 15 '14 at 06:30
1

None of the above worked for me.

But this does (tested on Windows 7 Pro x64):

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Folder\shell\Open console here\command]
@="u:\\users\\dave\\data\\bin\\Console2\\Console.exe cmd -r \"/k pushd %L\""

Replace the path with the path to your copy of console.exe (of course).

nerdfever.com
  • 1,652
  • 1
  • 20
  • 41
  • 1
    This adds it to the context menu when you right click on a folder/directory, which is useful, but the question is about how to add it to the context menu that appears when you right click on the folder background. – franzo Feb 17 '16 at 23:22
1

I think the relevant part of the TortoiseSVN installer is here. Perhaps you can figure out all the necessary registry keys from that.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
  • the problem with the tortoise svn one though is that they actually use handlers in c++ to do it, which would be overkill for something like this. but thanks for the response – user380527 Feb 04 '11 at 19:50
0

According to my personal experience of Windows XP (SP3), you can open Console2 inside the current directory with a context menu entry using the following .reg file:


  Windows Registry Editor Version 5.00 
[HKEY_CLASSES_ROOT\Folder\shell\console2]
@="Console2 Here"
[HKEY_CLASSES_ROOT\Folder\shell\console2\command]
@="C:\Program Files\Console\console.exe -d \"%1\""


If you look at the key value inside regedit.exe , you should see:
C:\Program Files\Console\console.exe -d "%1"


instead of:

C:\Program Files\Console\console.exe -d ""%1"" 

The latter would open Console2 in its default start directory.

Trikaldarshiii
  • 11,174
  • 16
  • 67
  • 95
jcoxi
  • 21
  • 2
  • 4
0

@Ben Voigt mentioned TortoiseSVN, you can also see WinMerge shell extension source code, or at last: create your own extension from scratch; I wanted to do something like this for XP but I have lots of other stuff to do now.

As a workaround, you can just open a folder in XP, and then select View->Explorer Bar->Folders, to have folder tree on left, and then you're able to right-click the folder (active folder gets hightlighted automatically).

command prompt on right click

jakub.g
  • 38,512
  • 12
  • 92
  • 130
0

Here it is if you prefer MinGW.

#!/bin/sh
reg add 'HKCR\Directory\Background\shell\sh' -d 'Open Bash window here'

reg add 'HKCR\Directory\Background\shell\sh\command' \
-d 'C:\MinGW\msys\1.0\bin\sh.exe -l'

printf 'cd -' >> ~/.profile

superuser.com/a/387273

Community
  • 1
  • 1
Zombo
  • 1
  • 62
  • 391
  • 407
-2

This can be achieved in XP as well. First open the program Run with the Windows key + R, and type Regedit in the textbox. Press Enter. In the Registry open the Key : HKEY_CLASSES_ROOT and then : * You will now see a key called : shell Rightclick on shell and point to New. Click in de menu on Key. Now type a name of your choice which you want to appear in the Rightclick menu. Rightclick on the name you chose, again point to New and click Key. Now type : command Click on command and in the right pane of the Registry doubleclick on (Default). In the textbox Value Data, type the path to an application you want to open via the chosen name in the rightclick menu. For example : "C:\Program Files\CCleaner\CCleaner.exe" Then type after the path : %1, and leave a space between the end of the path and %1 It should look like this :

"C:\Program Files\CCleaner\CCleaner.exe" %1

This way, it's possible to open any kind of application you want. There's only one drawback, you have to rightclick another file to see the chosen name with which you can open the application. When you rightclick a folder this will not work.

Sweet
  • 13
  • 2
  • 1
    Your answer simply produces the same .reg export that the OP *already* said he knew how to do, but, you're solution doesn't even work for clicking on folders, no less, more importantly, for clicking in the blank space in a Windows Explorer window as the OP is asking. His (@user380527) own answer is the correct one. – Flak DiNenno Dec 24 '13 at 23:10