How do properly add "Open Cmder" Here in the windows context menu?

I installed Cmder with the chocolatey: https://chocolatey.org/packages/Cmder

and I would like to have a shortcut in my context menu to open cmder in the current directory. I followed [the official wiki]:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
@="Open Cmder Here"
"Icon"="\"%CMDER_ROOT%\\icons\\cmder.ico\",0"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder\command]
@="\"%CMDER_ROOT%\\Cmder.exe\" /START \"%v\""

(https://github.com/cmderdev/cmder/wiki/Context-menu-integration) but even though the icon to start Cmder does show up in the context menu, it however throws an error in a message box saying:

Windows cannot access the specified device, path or file. You may not have the appropriate permissions to access the item.

The path of the Cmder executable is in: C:\tools\Cmder\Cmder.exe

The environment variable seems to be fine (been set with setx CMDER_ROOT "C:\tools\Cmder"):

echo %cmder_root%
C:\tools\Cmder

I can't really figure out what's wrong here, any idea?


Solution 1:

Use this REG file instead:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
@="Open Cmder Here"
"Icon"=hex(2):22,00,25,00,43,00,4d,00,44,00,45,00,52,00,5f,00,52,00,4f,00,4f,\
  00,54,00,25,00,5c,00,69,00,63,00,6f,00,6e,00,73,00,5c,00,63,00,6d,00,64,00,\
  65,00,72,00,2e,00,69,00,63,00,6f,00,22,00,2c,00,30,00,00,00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder\command]
@=hex(2):22,00,25,00,43,00,4d,00,44,00,45,00,52,00,5f,00,52,00,4f,00,4f,00,54,\
  00,25,00,5c,00,43,00,6d,00,64,00,65,00,72,00,2e,00,65,00,78,00,65,00,22,00,\
  20,00,2f,00,53,00,54,00,41,00,52,00,54,00,20,00,22,00,25,00,76,00,22,00,00,\
  00

Solution 2:

I tried adding to the registry as per suggested answers and searches. I couldn't get it to work. Finally, on the Cmder wiki I stumbled across the answer: Shortcut to open Cmder in a chosen folder

Shortcut to open Cmder in a chosen folder:

  1. Open a terminal as an Administrator.
  2. Navigate to the directory you have placed Cmder.
  3. Execute .\cmder.exe /REGISTER ALL

If you get a message "Access Denied" ensure you are executing the command in an Administrator prompt. In a file explorer window right click in or on a directory to see "Cmder Here" in the context menu.

Solution 3:

I had the same problem and I solved it using the plain path (without references to environment variables) and I got it working. So my .reg file looks like:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
@="Open Cmder Here"
"Icon"="C:\\path\\to\\Cmder\\cmder.ico,0"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder\command]
@="\"C:\\path\\to\\Cmder\\Cmder.exe\" /START \"%v\""

The "Icon" path indicates the file ".ico" path followed by the icon index to use.

Solution 4:

If you do not want to use environment variable use this as registry file or batch file. Let assume Cmder installation path is C:\MyFiles. Change that path as your setup.

  • Registry file (.reg):
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder]
@="Open Cmder Here"
"Icon"="\"C:\\MyFiles\\icons\\cmder.ico\",0"

[HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder\command]
@="C:\\MyFiles\\cmder.exe /START \"%v\""
  • Batch file (.bat):
reg add "HKCR\Directory\Background\shell\Cmder" /ve /d "Open Cmder Here" 
reg add "HKCR\Directory\Background\shell\Cmder" /v "Icon" /d "C:\MyFiles\icons\cmder.ico,0" 
reg add "HKCR\Directory\Background\shell\Cmder\command" /ve /d "C:\MyFiles\cmder.exe /START \"%v\"" 

Command Options:

  • reg add command:
REG ADD KeyName [/v ValueName | /ve] [/t Type] [/s Separator] [/d Data] [/f] [/reg:32 | /reg:64] 
    /v       The value name, under the selected Key, to add.
    /ve      adds an empty value name (Default) for the key.
    /t       If omitted, REG_SZ is assumed.
    /d       The data to assign to the registry ValueName being added.
  • Cmder option:

    /START [start_path] Folder path to start in.

  • Shortcut option:

    %v For verbs that are none implies all. If there is no parameter passed this is the working directory.

Solution 5:

I use Easy Context Menu, add de cmder.exe and select where you want to appear. I solved it this way.

https://www.sordum.org/7615/easy-context-menu-v1-6/

Regards.