How can I associate .sh files with Cygwin?

前端 未结 13 1376
旧时难觅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 22:12

    Look at the assoc and ftype commands in a dos box. Here's an example for .jpg on my machine

    c:\>assoc .jpg
    .jpg=jpegfile
    
    c:\>ftype jpegfile
    jpegfile="C:\Program Files\Common Files\Microsoft Shared\PhotoEd\PHOTOED.EXE" "%1"
    
    assoc .sh=bashscript
    
    ftype bashscript="c:\cygwin\bin\bash.exe" "%1"
    

    Make sure you change the path to bash in the ftype command to match where you have cygwin installed

提交回复
热议问题