Open Cygwin at a specific folder

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

    To create a Windows shortcut that launches a Cygwin terminal in a directory of your own choosing, try the following:

    • Right-click on the Windows desktop, select 'New', and then select 'Shortcut'.

    • For location of the item, enter the following text, changing the mintty path as needed and substituting the name of the desired directory where indicated.

      C:\cygwin64\bin\mintty.exe /bin/sh -lc 'cd DESIRED-DIRECTORY; exec bash'
      

      For example, the OP would use the following text:

      C:\cygwin64\bin\mintty.exe /bin/sh -lc 'cd /cygdrive/c/Users/Tom/Desktop/; exec bash'
      
    • Click 'Next'.

    • Enter the desired name for the shortcut and click 'Finish'.

    Multiple shortcuts can be placed on the desktop to open Cygwin terminals in various often-accessed directories.

    Inspired by solution posted on How to open a Cygwin shell at a specific directory from Netbeans? at superuser.com.

提交回复
热议问题