ConEmu: Open multiple Git Bash tabs on different l

2019-09-07 18:00发布

I need to setup startup tasks in order to have 3 git bash tabs opened on startup, each in different location.

To open various tabs on various places I used

cmd -new_console:s /k "%ConEmuBaseDir%\CmdInit.cmd"  & d: & cd \Projects\Project1

cmd -new_console:s /k "%ConEmuBaseDir%\CmdInit.cmd"  & d: & cd \Projects\Project2

cmd -new_console:s /k "%ConEmuBaseDir%\CmdInit.cmd"  & d: & cd \Projects\Project3

There is already a predefined task for Git bash

{Bash::Git bash}
"%ConEmuDrive%\Program Files\Git\git-cmd.exe" --command=usr/bin/bash.exe -l -i

So i tried following solutions

cmd -new_console:s /k "%ConEmuBaseDir%\CmdInit.cmd"  & d: & cd \Projects\Project1 {Bash::Git bash}

and

{Bash::Git bash} -new_console:s /k "%ConEmuBaseDir%\CmdInit.cmd"  & d: & cd \Projects\Project1

but none of them work.

How to solve it?

2条回答
做个烂人
2楼-- · 2019-09-07 18:38

Feels sad when an inexperienced user doesn't get a proper help from the author... Oh well. Simple solution is:

Open Settings.

Go to Startup > Tasks.

Click on the plus to add new predefined task.

Name it Git bash::Project1.

Fill in following command

-new_console:s:d:D:\Projects\Project1"%ConEmuDrive%\Program Files\Git\git-cmd.exe" --command=usr/bin/bash.exe -l -i

Repeat this step for all desired project. Add one new predefined task. Call it My. Fill in following

{Git bash::Project1}

{Git bash::Project2}

{Git bash::Project3}

Click on Startup.

Select Specified named task and select {My}.

Restart.

Voila.

查看更多
疯言疯语
3楼-- · 2019-09-07 18:42

Awful...

First of all, ConEmu docs tells that you may use simple -new_console:d:"d:\Projects\Project" to set startup directory.

You can't "execute" the {Bash::Git bash} from cmd.exe, what you try to do using /k switch. The {Bash::Git bash} is ConEmu Task and only ConEmu knows how to "run" it.

You last try {Bash::Git bash} /k "%ConEmuBaseDir%\CmdInit.cmd" is absolutely wrong. The Bash does not ever know how to execute *.cmd files. And bash.exe does not support the /k switch.

At last, your bash version may set specific directory via bash profile. Possible workarounds are described in docs.

BTW, instead of d: & cd \Projects\Project3 it's more handy and descriptive to call cd /d d:\Projects\Project3.

查看更多
登录 后发表回答