1

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?

Maximus
  • 10,751
  • 8
  • 47
  • 65

3 Answers3

0

I know nothing about ConEmu, but you should be able to run a shell script like:

#!/bin/sh
mintty --dir /c/code/project1 --exec ./task1 &
mintty --dir /c/code/project2 --exec ./task2 &
...

or

#!/bin/sh
mintty --exec /c/code/project1/task1 &
mintty --exec /c/code/project2/task2 &
...
varro
  • 2,382
  • 2
  • 16
  • 24
0
  • Tasks allow to run as many tabs/panes as you wish.
  • Docs explain how to run your shell in specific directory.
  • Ways to execute some command in bash shell on startup.

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"
Maximus
  • 10,751
  • 8
  • 47
  • 65
0

Make sure you add C:\tools\cygwin\bin path to your environment path.

In order to start cygwin session in the Conemu execute cygwin -new_console if you want to have admin privilages exucute cygwin -new_console:a.

Udesh
  • 2,415
  • 2
  • 22
  • 32