How can I set a shortcut in ConEmu to automatically open a new tab with Cygwin, and automatically start a given command (Say, SSH)?

3 Answers 3


So lets start with how to launch cygwin bash in a new tab. In my example I am using msys-git's cygwin bash because that's what I have installed:

Git Bash Task

The command I use is:

%systemroot%\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"

So that's an interactive shell. If I want to run ls from inside of cygwin bash, I can use sh -exec instead of sh --login -i It would look like this:

C:\Users\JDearing>"C:\Program Files (x86)\Git\bin\sh.exe" -exec "/bin/ls c:\\"
+ /bin/ls c:
$Recycle.Bin               VC_RED.MSI     install.exe
BOOTSECT.BAK               VC_RED.cab     install.ini
Chocolatey                 Windows        install.res.1028.dll
Documents and Settings     boot           install.res.1031.dll
EntLib41Src                bootmgr        install.res.1033.dll
Intel                      eula.1028.txt  install.res.1036.dll
MSOCache                   eula.1031.txt  install.res.1040.dll
PerfLogs                   eula.1033.txt  install.res.1041.dll
Program Files              eula.1036.txt  install.res.1042.dll
Program Files (x86)        eula.1040.txt  install.res.2052.dll
ProgramData                eula.1041.txt  install.res.3082.dll
Recovery                   eula.1042.txt  old_machine
RiskWorks                  eula.2052.txt  pagefile.sys
SWSetup                    eula.3082.txt  profiles
SafeBoot.fs                globdata.ini   sysinternals
SafeBoot.rsv               hiberfil.sys   vcredist.bmp
System Volume Information  ilspy
Users                      inetpub


So you can probably start ssh from cygwin bash with something like:

%systemroot%\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" -exec "/usr/bin/ssh [email protected]""

You might have to play with quotes. I'd suggest looking at my conemu tasks for reference.

  • 4
    cmd /c is excess in fact, unless you need to set up any environment variables before running ssh.exe. If you don't need to set up environment - you may run ssh.exe directly, without "cmd /c".
    – Maximus
    Apr 29, 2013 at 19:48
  • If I run it directly, it doesn't attach to conemu though. What should I do ?
    – Car981
    Apr 30, 2013 at 6:19
  • 1
    @Car981 You need to add that to a task like this. Also look at -new_console Apr 30, 2013 at 15:52
  • 2
    I had to use bash.exe -c "ssh ..." rather than bash.exe --exec "ssh ..."
    – Michael
    May 15, 2016 at 23:58

This is the most seemless way to get an SSH task up and running through ConEmu. Requires a bit more configuration, but it's worth it in the end.

Generate an ssh-key

Steps from excellent answer here: https://serverfault.com/questions/241588/how-to-automate-ssh-login-with-password. ssh-keygen will ask you a few questions. The default answers are fine. If you want to go with a blank passphrase, that's fine as well. Just keep your keyfile safe. Replace id, server and password with your credentials.

$ ssh-keygen -t rsa -b 2048

$ ssh-copy-id id@server password

$ ssh id@server

Add a task for ssh

  • Open the ConEmu settings, go to Startup->Tasks.
  • Click +
  • Name task something (I used "ssh")
  • In the large textbox for Commands, Tabs, Etc, place a new command:
    • ""C:\Program Files\Cmder\vendor\git-for-windows\bin\sh.exe" -exec "/usr/bin/ssh id@server""
    • Replace id and server with your own

(Optional) Set task as default task

  • Switch to the parent setting window "Startup"
  • In "Startup options" select the "Specified named task" radio button
    • From the dropdown, select the name of your task (ssh in my case)
  • Save settings

If you did everything correctly, your console will start up and ssh into your server of choice, no password required since you're using a passkey.


C:\cygwin64\bin\bash.exe --login -i -c "ssh myUser@myServer"

the -c will execute the following string command automatically after logging in for you

  • The other answers to this question are quite expansive, can you elaborate on this at all?
    – bertieb
    Feb 18, 2017 at 23:19
  • added some more Feb 18, 2017 at 23:32

You must log in to answer this question.

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