The guide at https://github.com/microsoft/terminal/blob/master/doc/user-docs/ThirdPartyToolProfiles.md suggests to use
{
"name" : "Cygwin",
"commandline" : "C:/Cygwin/bin/bash --login -i",
"icon" : "C:/Cygwin/Cygwin.ico",
"startingDirectory" : "C:/Cygwin/bin"
}
However, I'd like the startingDirectory
to be $USERPROFILE
. I have attempted various different methods to change the starting directory but they have all failed.
The trick is to use the chere
package in Cygwin, which is used to solve the same problem. First ensure chere
is installed in Cygwin. Then modify the commandline
to the following:
"name": "Cygwin",
"commandline": "c:\\cygwin\\bin\\bash.exe /bin/xhere /bin/bash",
"startingDirectory" : "%USERPROFILE%"
After this, you can change startingDirectory
to any path.
Note, for those that are annoyed by the starting /bin/bash
that is printed after launching Cygwin using this command you can simply comment out that line in /bin/xhere
using the following sed one-liner sed -i -e 's|^\s*echo Starting $1;|# \0|' /bin/xhere