0

这是我的 cygwin.bat 文件,用于通过 rxvt 启动 cygwin 终端窗口。

@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 shell”时打开 cygwin 终端 cd'd 到该路径的能力。开箱即用的默认 mintty 命令是

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

我做了

man mintty 

但我所看到的与 mintty 中的 rxvt --loginShell -e 选项等效的是 --exec。

有没有办法将我首选的登录 shell (bash) 和一些额外的参数传递给 mintty,就像我将它们传递给上面的 rxvt 一样?

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 回答