ConEmu: How to get the working directory of the foreground tab?

1

ConEmu experts

I enabled "single instance mode" and had multiple consoles opened as tabs, each with different working directory. I need to write a task that does something in the foreground tab's working directory. But the environmental variable {ConEmuWorkDir} always holds the working directory of the first-created tab, no matter under which tab I invoke the task.

So how to refer to the working directory of the foreground tab? Could it be accomplished by GuiMacro, and how?

Thanks

Rafa

Posted 2014-07-13T11:55:43.697

Reputation: 11

Answers

0

Supposing to have prompt in each tab, you may just use GuiMacro Print to paste&run something in your prompt.

Alternatively, you may use Shell("new_console:I", ...) to create new tab inheriting current tab environment (including current working folder).

Maximus

Posted 2014-07-13T11:55:43.697

Reputation: 19 395

Thanks Maximus. I try to run ConEmuC -GuiMacro print "pwd" in a task and want to see it appear after the prompt. But it does not. Instead a new tab opens and displays "OK". What I did wrong here? – Rafa – 2014-07-14T13:30:53.373

You do not need to run task. Set up hotkey for your macro in the settings. That's all. If you really need to run print from outside - use -GuiMacro:0 command with -new_console:b switch. – Maximus – 2014-07-14T21:32:40.997