Configuring Cygwin for ConEmu with a different start directory

I am using ConEmu 64bit with Cygwin 64bit on a machine running Windows 7.

I do not want to set the working directory for cygwin in my .bashrc, since I like to configure several tasks for Cygwin with different path parameters.

I set the "home directory" in the task parameters:

\dir "D:\Downloads\Programming\Selenium\"

and added this line in the command window:

C:\cygwin64\Cygwin.bat --login -i

However, Cygwin does not start in the "cygwinized" version of this directory (/ cygdrive / d / Downloads / Programming / Selenium), but in my user's "normal" home directory (~).

I just found how to add a new path in bashrc. Maybe one of you can enlighten me.

+4
2

, C:\cygwin64\Cygwin.bat? ?

@echo off
C:
chdir C:\cygwin64\bin
bash --login -i

, Cygwin.bat bash .


, Cygwin ! , cygwin cd "${HOME}" /etc/profile script.

, , bash msysgit .


/etc/profile script CHERE_INVOKING CD. , cygwin :

set CHERE_INVOKING=1 & c:\cygwin64\bin\sh.exe --login -i

, wiki page.

+5

( Cygwin-Tab , ) :

Maximus, Cygwin- Bash C:\cygwin64\Cygwin.bat, . , .

.bash_profile:

if [ -f "${HOME}/startup.sh" ] ; then
  source "${HOME}/startup.sh"
fi


startup.sh

cdc "D:\Downloads\Programming\Selenium\"
#cdc is a custom function, see .bashrc


.bashrc

cdc()
{
   # converts a double-quoted windows-path and changes directory to it
   p=$(cygpath -u "$1")
   cd "$p"
}

, bash , startup.sh. , , Cygwin- startup.sh .bashrc. - , startup.sh.

:

Cygwin.bat C:\opt\ConEmu\ConEmu :

Cygwin.bat

@echo off

C:
echo cdc %1 > C:\opt\cygwin64\home\%USERNAME%\startup.sh 

:: Your ConEmu-Task-definition here
C:\opt\ConEmu\ConEmu64.exe /Single /cmd {Cygwin}

cdc, , , startup.sh ConEmu-Task Cygwin. , Cygwin :

ConEmu {Cygwin}

"C:\opt\cygwin64\Cygwin.bat"



Cygwin.bat . Windows, Cygwin.bat .

0

Source: https://habr.com/ru/post/1529326/


All Articles