cmder: Using the context menu doesn't open a new tab in Single Instance Mode

With Appearance > Single Instance Mode checked… Using Cmder Here in the context menu opens correctly for the first time, but when trying again in another folder, it does not add a new tab to Cmder, it just focuses the existing tab.

Unchecking Single Instance Mode works as expected with new windows each time.

This worked ok with ConEmu Here.

I guess it’s something that has to do with init.bat or the default {cmd} task, but I couldn’t figure it out.

Tested on Win 7 and Win 8.1.

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Reactions: 1
  • Comments: 31 (9 by maintainers)

Most upvoted comments

Here my workaround, after registered “ConEmu here” :

  1. Open regedit, go to HKEY_CLASSES_ROOT > Directory > Background > shell > Cmder here > command (I named it “Cmder here” instead of the default “ConEmu here”)
  2. Change the entry for "[Path to Cmder]\Cmder.exe" /SINGLE "%V". It will open, at the first call, on the right current directory. However all “Cmder here” calls after will only have the same directory from the first tab, no mater from where you call it (as reported here).
  3. Change the default task in Cmder settings Startup > Tasks to cmd /U /K "set CMDER_START=%cd% & %ConEmuDir%\..\init.bat" -new_console:n and check “Default task for new console” setting.

As in the ini.bat, if we defined a CMDER_START environment variable, it will cd on this directory (in where the click happens). No need to modify files so the update will not replace them.

But this is a workaround, Cmder.exe should be fixed to have consistent behavior.

This is still not working for me, I tried with both cmder 1.3.2 and by building the github head

  • I tick Single instance mode
  • In the registry for Computer\HKEY_CLASSES_ROOT\Directory\Background\shell\Cmder\command I set “C:\cmder\Cmder.exe” /SINGLE “%V”
  • I then try a directory right click -> Cmder here
  • Also tested from a cmd.exe to do "c:\cmder\Cmder.exe /SINGLE “c:\Temp”

I get a new tab in the (single) window but it does not change directory

Any help ?

@michidk /register all does not honor /single unless you do /register all /single same thing for /register user /single.

I wrote this support so I know it worked on my system. I will need to test it again.

I don’t think this is actually fixed? I’m having the exact same problem on 1.3.0.

I’ve changed the registry entry for “Cmder here” to "C:\Cmder\Cmder.exe" /single "%V" and each command prompt opens in a new tab. The only problem is that each tab is opened in the same directory as the first tab, no matter which directory I select “Cmder here” in.

I have also met this issue. I find that if you use quake-style slide down option, then when you use “cmder here”, the new tab will be opened on current window instead of a new one. image

I am using the latest cmder.

@MrKuja I use your solution at the version 1.3.1 , but it still only have the same directory from the first tab.

👍

This doesn’t seem to be working in the latest pre-release for me v1.2.9 with Appearance > Single Instance Mode checked or /single parameter in shortcut.

Or perhaps I am misunderstanding what this option is supposed to do. I expect this to only show a single instance in the task bar (no stacking). Similar to the option for Internet explorer.

Related to https://github.com/cmderdev/cmder/issues/525 and maybe https://github.com/cmderdev/cmder/issues/197

I’m currently using the following workaround:

Create workaround.bat next to Cmder.exe with the contents:

@echo %1 > "%~dp0\CMDER_CD"
@"%~dp0\Cmder.exe" /SINGLE

Use regedit to edit the registered context menu entry (search for “Cmder”) and replace “Cmder.exe” with “workaround.bat” in the entry of the command folder. sicpa-net_chl0112383_20150825_095454_tneumann_registry editor

Then add the following to init.bat in the vendor directory of your cmder installation:

@if not exist "%CMDER_ROOT%\CMDER_CD" (
    @goto ENDCD
)

@set /p CMDER_CD= < "%CMDER_ROOT%\CMDER_CD"
@del "%CMDER_ROOT%\CMDER_CD"

@cd /d %CMDER_CD%

:ENDCD

You’ll notice a standard cmd window opening and closing when you “Cmder here” which you could workaround by replacing workaround.bat with a vbscript, put for me this is good enough.

Obviously, if you are using powershell, you’ll need to port the part added to init.bat to you powershell initialization file.