jayven huangjunwen
jayven huangjunwen

Reputation: 780

(ConEmu + Cygwin) How to change tab name of ConEmu from within a cygwin bash script

i've configuring my ConEmu + Cygwin enviroment. I've created a task, when i start it in a tab, the task will run a batch file, which in turn will change dir into cygwin and run

bash --login -i my_ssh_entry_script.sh

Inside my_ssh_entry_script.sh, it will read a config file in my home directory then print a menu for me to select which host to connect. And finally

...
exec ssh -p$port $userhost

Now i can work on the selected machine in the same conemu tab. This works fine. And the script also works on linux machine too.

But there is a little flaw. I can't change the tab's title. I've tried to change it to:

....
exec $(cygpath ${ConEmuDir})/ConEmu.exe /cmd ssh -p$port $userhost -cur_console:t:$title

But this will always create a new tab. Any suggestion to slove it? Thanks~

Upvotes: 7

Views: 3179

Answers (2)

Marius Pojar
Marius Pojar

Reputation: 41

At least for cmd shell: "-new_console:d:C:\Users\dir_name" cmd /V /K -new_console:t:Tab_renamed

Upvotes: 4

Maximus
Maximus

Reputation: 10847

1) You need GuiMacro, thoroughly described in the project wiki: http://conemu.github.io/en/GuiMacro.html

ConEmuC -GuiMacro Rename 0 "Title"

2) You do not need to run batch. It causes extra and useless cmd.exe in yours process tree. You can do all required "CD" and "SET" from the task content directly.

Upvotes: 10

Related Questions