Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there way to "duplicate" session in ConEmu.

I know it's not possible for every kind of terminal (cmd.exe, powershell, etc), but I'm most interested in following situation:

  • I'm in cmd.exe console inside ConEmu.
  • By typing Ctrl-T (the shortcut I specified) I am able to open a new console tab, with a new session (cmd.exe).

I want this session to start in the same directory as the first one, original one. I'm feeling that it can be done with %cd% variable or similar, but I couldn't manage it.

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

Type in existing cmd prompt

cmd -new_console

and press Enter. Also you may create hotkey/macro for this sequence, for example AppsN -->

print("cmd -new_console\n")

or create cmd-file or doskey alias.

share|improve this answer
    
Thanks. It's not perfect solution, because it doesn't work if I'm in a middle of some application (ssh, vagrant, anything that can be waited for long). But, it's a solution. And thanks again. –  Michael Field Oct 31 '12 at 10:51
    
If you are in a middle ssh (or smth other) - "duplicate session" will be ambiguous. Because "what to duplicate"? You active session is ssh, not cmd. Yes, cmd may be at the bottom of the process stack, but what is it state? Undetermined I guess... –  Maximus Oct 31 '12 at 11:09
    
You're right. But still, very often I need exactly that: to duplicate the last state of the bottom of the process stack. –  Michael Field Nov 9 '12 at 17:45
    
Well, check 121109. "Duplicate root" in Tab menu. Works with cmd. –  Maximus Nov 9 '12 at 23:47
add comment

The following will do the same thing for PowerShell

ConEmu64.exe /config "shell" /dir "$(pwd)" /cmd powershell -new_console:n

I created the following function that is loaded in my PowerShell profile

function Create-Console($path = $(pwd)) {
  $console = Resolve-Path (join-path (join-path "$env:PROGRAMW6432*" "console*") "ConEmu64*");
  . $console /config "shell" /dir "$path" /cmd powershell -new_console:n
}

Set-Alias sh Create-Console

Then I can execute the following in the console to create a new PowerShell tab in the same directory:

> sh

or create a tab in a different directory with:

> sh c:\some\directory\path
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.