Configure XP file associations from the command prompt
One of my developers asked how to get a .sh file to be runnable from windows today. I told him it should probably just work, with Cygwin… but apparently, it doesn’t. He went to lunch, so I gave it a go… my first attempt at making the file association through the GUI wasn’t fruitful, so Googling got me on the right track. Actually, the second bit of info was most elegant, and shows how to make file associations from the windows command prompt… slick. Here it is: (idea stolen from here)…
To make cygwin able to run “.sh” shell scripts (like .bat batch files), automatically, you need to do this on the machine:
C:\> assoc .sh=bash C:\> ftype bash=c:\cygwin\bin\bash.exe %1 %*
I never knew about the ‘assoc’ and ‘ftype’ commands at the cmd.exe prompt before. Cool!
You can then double-click on .sh files and they’ll run properly (assuming of course you have cygwin installed in c:\cygwin… but this is where it is on our Copenhagen servers…)
Just the ticket Ben. Useful for running backup .sh scripts on my localhost test server.