bashcygwinconemu

How to open multiple ConEmu/CygWin Bash terminals at different directories


I have a Windows environment set up using ConEmu and CygWin64 and I frequently have to open up four different Windows directories and run a script there to launch a server.

In total I have these four things running in order to have a local version of our environment operating.

Like so;

C:\code\project1\private-api
C:\code\project2\public-api
C:\code\project2\management-agent
C:\code\project3\back-office

So far I have just been manually opening new ConEmu/CygWin Bash tabs and navigating via command line to each directory I need then running the scripts. This is tedious though and I figure there must be a way to have ConEmu launch multiple CygWin Bash tabs in different, specific directories (and maybe even run a script in each directory) but I am at a loss as to how to accomplish this.

I considered trying to do this via a Windows batch script too but I couldn't figure out how to launch ConEmu/CygWin bash windows from a batch file. I'm thinking it's not possible.

I have followed the documentation for ConEmu Tasks but the docs for Task parameters and commands are still confusing me. I tried following the answer in this question as well with little success;

ConEmu: Open multiple Git Bash tabs on different locations

Anyway, here is how I have my current ConEmu CygWin Bash task set up, which works great when opening single tabs in my home directory (had to provide a link, I keep getting errors when trying to upload an image here);

ConEmu CygWin Bash Task config

Name

Bash::CygWin bash

Task parameters

None

Commands

set CHERE_INVOKING=1 & %ConEmuDrive%\cygwin64\bin\sh.exe --
login -i -new_console:C:"%ConEmuDrive%\cygwin64\Cygwin.ico"

Is it actually possible with a ConEmu/CygWin64/CygWin Bash set up to accomplish what I want?


Solution

  • Example for two tabs with directories

    set CHERE_INVOKING=1 & %ConEmuDrive%\cygwin64\bin\sh.exe -l -i -new_console:d:"C:\code\project1\private-api" -new_console:C:"%ConEmuDrive%\cygwin64\Cygwin.ico"
    
    set CHERE_INVOKING=1 & %ConEmuDrive%\cygwin64\bin\sh.exe -l -i -new_console:d:"C:\code\project2\public-api" -new_console:C:"%ConEmuDrive%\cygwin64\Cygwin.ico"