How can I associate .sh files with Cygwin?

前端 未结 13 1264
旧时难觅i
旧时难觅i 2021-01-29 21:32

I\'d like to run a long rsync command in Cygwin by double clicking on a .sh file in Windows. It must start in the file\'s containing directory (e.g. /cygdrive/c/scripts/) so th

13条回答
  •  抹茶落季
    2021-01-29 21:57

    I use PuttyCyg (awesome putty in Cygwin window) here's how to get it all going:

    Create a batch script, eg. on my machine I used

    C:\Dev\scripts\cygbashrun.bat
    

    with contents

    SET CYGWIN=nodosfilewarning
    C:\Cygwin\bin\putty.exe -cygterm /bin/bash.exe %1
    

    Obviously adapt to contain the paths of your install of PuttyCyg.

    Then in Windows File Explorer go to Tools - Folder Options - File Types

    Create a ".sh" entry if there isn't already (or .bash depending on what you like your scripts to have).. then Advanced..

    [optional step] change the icon and select the Cygwin icon from your install

    Then:

    1. New..
    2. Action = Run Bashscript..
    3. Application used to perform this action = C:\Dev\scripts\cygbashrun.bat "%1"

    Works like a charm for me :O)

提交回复
热议问题