0

これは、rxvt 経由で cygwin ターミナル ウィンドウを起動するための cygwin.bat ファイルです。

@echo off

C:

set PATH=%PATH%;C:\cygwin\bin

REM SHELL needed for any screen instances started from bash
set SHELL=/bin/bash
set HOME=C:\cygwin\home\Dragos
set HOMEDRIVE=C:
set HOMEPATH=\cygwin\home\Dragos

REM This part is for chere generated context menu item "Open Bash shell here"
REM 
if not [%1]==[] (
  C:\cygwin\bin\cygpath %1 > tmpFile
  set /p startingpath= < tmpFile
  del tmpFile
)

if "%startingpath%"=="" C:\cygwin\bin\rxvt --loginShell -sr
if not "%startingpath%"=="" start C:\cygwin\bin\rxvt --loginShell -e /bin/bash --login -c "cd '%startingpath%'; exec /bin/bash -rcfile ~/.bashrc"
exit

rxvt から mintty に切り替えたいのですが、フォルダーを右クリックして [ここで Bash シェルを開く] を選択したときに、そのパスに cd された cygwin ターミナルを開く機能を失いたくありません。すぐに使用できるデフォルトの mintty コマンドは次のとおりです。

C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -

やった

man mintty 

しかし、mintty の rxvt --loginShell -e オプションに相当するのは --exec だけです。

上記の rxvt に渡したのと同じ方法で、好みのログイン シェル (bash) といくつかの追加パラメーターを mintty に渡す方法はありますか?

4

1 に答える 1

0

これが私が思いついたものです。他の人が cygwin.bat として持っているものを見ることに非常に興味があります

@echo off

C:

set PATH=%PATH%;C:\cygwin\bin

REM SHELL needed for any screen instances started from bash
set SHELL=/bin/bash
set HOME=C:\cygwin\home\Dragos
set HOMEDRIVE=C:
set HOMEPATH=\cygwin\home\Dragos

REM 

if not [%1]==[] (
  C:\cygwin\bin\cygpath %1 > tmpFile
  set /p startingpath= < tmpFile
  del tmpFile
)

if "%startingpath%"=="" start C:\cygwin\bin\mintty.exe --icon /Cygwin-Terminal.ico --size 140,50 --exec /bin/bash --login -c "exec /bin/bash -rcfile ~/.bashrc"
if not "%startingpath%"=="" start C:\cygwin\bin\mintty.exe --icon /Cygwin-Terminal.ico --size 140,50 --exec /bin/bash --login -c "cd '%startingpath%'; exec /bin/bash -rcfile ~/.bashrc"
exit
于 2012-03-09T21:30:32.443 に答える