【问题标题】:Converting from rxvt login batch to mintty in cygwin在 cygwin 中从 rxvt 登录批处理转换为 mintty
【发布时间】:2012-03-27 07:29:56
【问题描述】:

这是我的 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 一样?

【问题讨论】:

    标签: cygwin rxvt mintty


    【解决方案1】:

    这就是我想出的。我很想看看其他人的 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
    

    【讨论】:

    • 从 rxvt 切换到 mintty 的一个很好的优势是,您可以在从术语窗口中选择文本时按 Alt 键进行列选择。
    最近更新 更多