I want to create a 2x2 grid of console, and I want it to be my default setting, meaning when I open ConEmu, this setting to be the startup setting. I have written a task like below:

>* cmd -cur_console:n

*powershell -cur_console:s1TVn

cmd /A /Q /K "C:\dev\msys64\msys2_shell.bat" -cur_console:s1THn

ghci.exe -cur_console:s2THn

The problem is with the last command. I want to start msys2, but when I run my task, for the third line, I get a console, but it doesn't run inside the ConEmu, it opens it as a separate window. How can I fix this configuration?

Also, how can I set this configuration as the default one when I start ConEmu, while now when I start it, I only get a single cmd console.

5 Answers 5


Look inside msys2_shell.bat to get the answer. This batch runs mintty instead of bash shell. Useless. Change third line to full path to bash.exe -l -i.

how can I set this configuration as the default one when I start ConEmu

There is "Startup" settings page in ConEmu, isn't it?

  • kind of useless answer, isn't it? Commented Mar 28, 2018 at 18:20
  • 3
    Newer versions of MSYS2 have adapted to ConEmu. Now it is enough to start the shell with msys2_shell -conemu in the default install.
    – Alexander
    Commented Dec 9, 2019 at 14:38

What to do is actually pretty simple, once you peel all the layers away. This works well as an invocation (make sure to modify it to your specific MSYS2 install location):

set CHERE_INVOKING=1 & set MSYSTEM=MINGW64 & "c:\msys64\usr\bin\bash.exe" --login -i

I would personally recommend setting the shell to inherit your PATH:

set CHERE_INVOKING=1 & set MSYSTEM=MINGW64 & set MSYS2_PATH_TYPE=inherit & "c:\msys64\usr\bin\bash.exe" --login -i

My ConEmu Tasks settings page ends up looking like this: ConEmu Startup::Tasks Page

Breaking it All Down

MSYS2 likes to configure the shell according to environment variables rather than command line parameters. Passing options into a program that way might seem unnatural at first, but basically it just follows this simple series: set VAR=value & set VAR2=value & "c:\path\to\command" [args]

  • CHERE_INVOKING - if set to 1, bash starts in the current working directory, otherwise it starts in the user's home dir. This needs to be set to 1 to allow the shell to work as-expected from the Explorer Window context-menu.

  • MSYSTEM - which MSYS2 subsystem to use. There are three: MSYS, MINGW32, and MINGW64. The MSYS subsystem should only be used for pacman command operations and so I typically only invoke that via the old-skool start menu icon on the very rare occasion it's needed. MINGW32 is useless to all by a select few users and you know who you are already, probably.

  • MSYS2_PATH_TYPE - if unset MSYS uses a minimal PATH environment that contains only MSYS binaries and a couple select Windows system paths, and is a required mode for MSYSTEM=MSYS shell only. For MINGW shells it's recommended to use inherit -- I've been using MSYS2_PATH_TYPE=inherit without issues for years.

There's another variable MSYSCON mentioned by another answer and referenced in msys2_shell.cmd -- ignore it. It's only for use within the msys2_shell.cmd batch file and holds no bearing on the behavior of bash.exe or MSYS shell initialization.

MSYS2 installation Location

The MSYS2 path has been intentionally hard-coded as c:\msys64\ since that's the default install location for the MSYS2 Windows installer. It doesn't make sense in this case to use %ConEmuDir% since that's relative to %PROGRAMFILES%, and MSYS2 is more typically installed relative to the root directory of the hard drive. Note that it does make sense to use %ConEmuDir% when referencing the MSYS2 shell that comes with Git for Windows, since that is installed relative to %PROGRAMFILES%.

There is no easy way to know the install location of MSYS2. There's no environment variable set up by MSYS2 either, as much as I wish there was. Wouldn't it be swell if MSYS2 had an option to export something liek MSYSTEM_HOME into your machine's environment? But it doesn't, so it's entirely on you as a user to know where it's installed and point ConEmu there.

Regarding msys2_shell.cmd :

Don't use it. The batch file is incorrectly named. It should be called msys2_terminal.cmd or similar since what it's actually doing is a setting up an entire terminal for the shell. This is a common terminology mistake, especially on Windows operating systems where there's never really been a clear separation of terminal from shell. Here's how it works, explained from a Windows-user perspective:

  • Shell - this is the command processor and batch/script runner. It is essentially a command line application much like any other command line application. A shell doesn't even require any visible window or keyboard connections. It can operate entirely in the background on files, streams, or other sources of data input/output.

  • Terminal - this is a windowed application that provides a keyboard/mouse interface to the shell program. In windows it's often referred to as a Console Window. Keyboard commands are piped to the shell program, and output is displayed inside of the window with scrollbars, colored text, and other fun features.

In this scenario, I want my terminal to be ConEmu and my shell to be BASH (mingw64). Therefore I want ConEmu to start the shell and only the shell. I don't want ConEmu to start mintty. Those are both terminals and that would cause us to get secondary pop-up windows -- one for ConEmu and one for mintty. But that's exactly what trying to run msys2_shell.cmd will do. So don't use it.

  • 3
    this answer helped me a lot but didn't quite get me there; it left me with broken ansi color handling. It couldn't run my vim setup. set "PATH=C:\msys64\usr\bin;%PATH%" & set CHERE_INVOKING=1 & set MSYSTEM=MINGW64 & set MSYS2_PATH_TYPE=inherit & set HOME=/c/Users/Me & "c:\Program Files\ConEmu\ConEmu\conemu-msys2-64.exe" "c:\msys64\usr\bin\bash.exe" --login -i -new_console:p this is what worked for me. I adapted it from the setup that comes with git for windows. It uses the conemu-msys2-64.exe connector that ships with current versions of ConEmu. 256 colors working just fine.
    – jorelli
    Commented Feb 11, 2019 at 3:11
  • 1
    for scoop, here's what i use: set "PATH=C:\Users\Me\scoop\apps\msys2\current\usr\bin;%PATH%" & set CHERE_INVOKING=1 & set MSYSTEM=MINGW64 & set MSYS2_PATH_TYPE=inherit & set HOME=/c/Users/Me & "c:\Users\Me\scoop\apps\conemu\current\ConEmu\conemu-msys2-64.exe" "C:\Users\Me\scoop\apps\msys2\current\usr\bin\bash.exe" --login -i -new_console:p
    – XoXo
    Commented Sep 6, 2019 at 19:02

I also had problems getting MSYS2, MinGW32 and MinGW64 shells (v2016-12-07) to work in ConEmu v161206.

The only (half-portable) working solution I've found is the following.

  1. Create a new task with the name {Shells::mingw-64} and the following commands in ConEmu for the MinGW64 shell:

    set MSYSTEM=MINGW64 & set MSYSCON=conemu64.exe & "%ConEmuDir%\..\..\..\msys64\usr\bin\bash.exe" --login -i -new_console:C:"%ConEmuDir%\..\..\..\msys64\mingw64.exe"
  2. Create a new task with the name {Shells::mingw-32} and the following commands in ConEmu for the MinGW32 shell:

    set MSYSTEM=MINGW32 & set MSYSCON=conemu64.exe & "%ConEmuDir%\..\..\..\msys64\usr\bin\bash.exe" --login -i -new_console:C:"%ConEmuDir%\..\..\..\msys64\mingw32.exe"
  3. Create a new task with the name {Shells::msys2-64} and the following commands in ConEmu for the MSYS2 shell:

    set MSYSTEM=MSYS & set MSYSCON=conemu64.exe & "%ConEmuDir%\..\..\..\msys64\usr\bin\bash.exe" --login -i -new_console:C:"%ConEmuDir%\..\..\..\msys64\msys2.exe"

Attention: Modify the relative paths above to match the path to MSYS2 on your system.

The solution is half-portable, since it explicitly states the ConEmu executable (change it to ConEmu.exe for x86).

I am not sure if the value of the MSYSCON environment variable matters. I've only set it for safety, because the MSYS2 batch file msys2_shell.cmd also sets it.

An alternative is to use the msys2_shell.cmd batch script. This approach has the huge disadvantage that the msys2_shell.cmd spawns a new process via the Windows START command, therefore two tabs are added in ConEmu.

  1. Create a new task with the name {Shells::mingw-64} and the following commands in ConEmu for the MinGW64 shell:

    "%ConEmuDir%\..\..\..\msys64\msys2_shell.cmd" -mingw64 -conemu -new_console:C:"%ConEmuDir%\..\..\..\msys64\mingw64.exe"
  2. Create a new task with the name {Shells::mingw-32} and the following commands in ConEmu for the MinGW32 shell:

    "%ConEmuDir%\..\..\..\msys64\msys2_shell.cmd" -mingw32 -conemu -new_console:C:"%ConEmuDir%\..\..\..\msys64\mingw32.exe"
  3. Create a new task with the name {Shells::msys2-64} and the following commands in ConEmu for the MSYS2 shell:

    "%ConEmuDir%\..\..\..\msys64\msys2_shell.cmd" -msys -conemu -new_console:C:"%ConEmuDir%\..\..\..\msys64\msys2.exe"

The msys2_shell.cmd is intended to be used directly from a CMD.EXE, with ConEmu64.exe / ConEmu.exe in the PATH:

msys2_shell -mingw64 -conemu

That command opens a new MinGW64 tab in ConEmu.

tl;dr: I recommend the first approach. Here is a screenshot as a proof in ConEmu:

Working MSYS2 MinGW64 shell in ConEmu

  • This answer is OK but much more complicated than is required. The -new_console:C:"%ConEmuDir%\..\..\..\msys64\mingw64.exe" part is not necessary, among other things.
    – jstine
    Commented Feb 21, 2018 at 16:39
  • 1
    I agree with jstine, for me this did the job: set MSYSTEM=MINGW32 & set MSYSCON=conemu64.exe & "c:\msys32\usr\bin\bash.exe" --login -i
    – karelv
    Commented Jun 17, 2019 at 15:50
  • Thanks @karelv, managed to get a version of your command working, but had to change some paths: set MSYSTEM=MSYS & set MSYSCON=conemu64.exe & "c:\msys64\usr\bin\bash.exe" --login -i ; also note, by default it cd's to ~ as home at start.
    – sdbbs
    Commented Apr 21, 2021 at 5:42

In recent versions of conemu, the msys2 shell comes as one of the default shells and can be found under:

{Bash} -> {Msys2 64}

If you have an old installation of conemu and don't have the msys2 shell, you can update to the latest version and run the 'Add/refresh default tasks' button under the 'Setup tasks...' button


To open an MSYS2 Shell Tab in an existing ConEmu instance, you can configured a Task with these settings:

  • Name: Bash::MSYS2 Bash
  • Task Parameters: -dir C:\some-start-dir -icon C:\msys64\msys2.ico
  • Commands: C:\msys64\msys2_shell.cmd -defterm -no-start -shell bash -where C:\some-start-dir -new_console:m:""

The options -defterm and -no-start which prevent that a separate Window is opened outside ConEmu.

The option -new_console:m:"" instructs ConEmu that it does not automatically prefix the path with /mnt/ during the conversation to Unix style when you copy/paste a Windows path into the terminal window.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .