Open Cygwin at a specific folder

后端 未结 29 2598
悲哀的现实
悲哀的现实 2020-12-12 08:49

How can I create a Cygwin shortcut that will open Cygwin at a specific folder? This would obviate having to type

cd /cygdrive/c/Users/Tom/Desktop/

29条回答
  •  借酒劲吻你
    2020-12-12 09:33

    Save the following code as a file: cygwin_bash.reg

    This will add opening Cygwin in the current directory and opening Cygwin in the specified folder at the same time.

    Use ".bashrc" instead of ".bash_profile" configuration. Because of exec bash. .bashrc is executed for interactive non-login shells. see: https://apple.stackexchange.com/questions/51036/what-is-the-difference-between-bash-profile-and-bashrc

    Windows Registry Editor Version 5.00
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\z_cygwin_bash]
    @="Cygwin Here"
    "Icon"="C:\\cygwin64\\Cygwin.ico"
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\z_cygwin_bash\command]
    @="C:\\cygwin64\\bin\\mintty.exe /bin/sh -lc 'cd \"`cygpath \"%V\"`\"; exec bash'"
    
    [HKEY_CLASSES_ROOT\Directory\shell\z_cygwin_bash]
    @="Cygwin Here"
    "Icon"="C:\\cygwin64\\Cygwin.ico"
    
    [HKEY_CLASSES_ROOT\Directory\shell\z_cygwin_bash\command]
    @="C:\\cygwin64\\bin\\mintty.exe /bin/sh -lc 'cd \"`cygpath \"%V\"`\"; exec bash'"
    
    

提交回复
热议问题