首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在cygwin中从rxvt登录批转换为mintty

在cygwin中从rxvt登录批转换为mintty
EN

Stack Overflow用户
提问于 2012-03-10 05:05:21
回答 1查看 1.4K关注 0票数 0

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

代码语言:javascript
复制
@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,但我不想失去在右击文件夹并选择"Open Bash shell here“时打开cygwin终端cd到该路径的能力。开箱即用的默认mintty命令是

代码语言:javascript
复制
C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico -

我做到了

代码语言:javascript
复制
man mintty 

但我看到的等同于mintty中的rxvt --loginShell -e选项的是--exec。

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

EN

回答 1

Stack Overflow用户

发布于 2012-03-10 05:30:32

这是我想出来的。我很有兴趣看看别人有什么作为他们的cygwin.bat

代码语言:javascript
复制
@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
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9640978

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档