Open Cygwin at a specific folder

后端 未结 29 2650
悲哀的现实
悲哀的现实 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:16

    For cygwin64 or installations without chere you can use the following command in a registry entry (assuming windows due to your path, also assuming cygwin installation directory is c:\cygwin64)

    C:\cygwin64\bin\mintty.exe /bin/sh -lc 'cd "`cygpath "%V"`"; bash'
    

    Works on Windows 7 and 8 Registry file available for download here: http://tomkay.me/blog/Cygwin64---Open-Here-18

    Windows Registry Editor Version 5.00
    ; Open cygwin to folder
    ; http://tomkay.me - Tom Kay
    
    [HKEY_CLASSES_ROOT\Folder\shell\open_cygwin]
    @="Open Cygwin Here"
    
    [HKEY_CLASSES_ROOT\Folder\shell\open_cygwin\command]
    @="C:\\cygwin64\\bin\\mintty.exe /bin/sh -lc 'cd \"`cygpath \"%V\"`\"; bash'"
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\open_cygwin]
    @="Open Cygwin Here"
    
    [HKEY_CLASSES_ROOT\Directory\Background\shell\open_cygwin\command]
    @="C:\\cygwin64\\bin\\mintty.exe /bin/sh -lc 'cd \"`cygpath \"%V\"`\"; bash'"
    

提交回复
热议问题