Add context menus to shell scripts without extensions

Fieldhouse, Dirk Fieldhouse@logica.com
Fri May 14 14:54:00 GMT 1999


The normal Windows association mechanism relies on the extension of the
file. If you want Windows to recognise your beautiful Cygwin shell scripts,
you have to sully them with .sh extensions, or similar.

Or do you? Rereading 'Inside OLE', I discovered that Windows can be made to
recognise shell scripts from the initial '#!' characters and to associate
such scripts with an appropriate program. This mechanism is overridden by an
extension that has an association and it doesn't help in associating 'make'
with files named Makefile - unfortunately that hook seems to be truly
missing.

Attached is a Windows .inf file that adds Open and Run context menu entries
to shell scripts. This is a standard Windows text file that you can install
using the Install entry on the context menu. It is supposed to set up an
uninstall entry for itself.

To install, first edit (eg with notepad) the file paths in the localisation
section at the end of the file to set your preferred (\n-capable) editor and
the location of your sh.exe. Then do right-click/Install. 

 <<Posixsh>> 
Warning: as always there is no guarantee that this software will work or
indeed that it won't fry your machine. It has been tested on Windows 95
OSR2.1. In particular I'd be happy to hear from any brave NT user who
succeeds or otherwise with this little hack (installing or using or both).

Happy right-clicking.

-- 
Dirk Fieldhouse                 Logica UK Limited
fieldhouse@logica.com           75 Hampstead Road
c=gb;a=attmail;p=logica;        London NW1 2PL
o=LOGICA;ou1=UK;s=fieldhouse    UK
+44 (171) 637 9111


Not speaking for Logica



begin 600 POSIXSH.INF
M.R!#;W!Y<FEG:'0@*&,I(#$Y.3D@1&ER:R!&:65L9&AO=7-E#0H[(%!E<FUI
M<W-I;VX@:7,@9W)A;G1E9"!T;R!R961I<W1R:6)U=&4@=&AI<R!F:6QE(&EN
M(&%N>2!W87D@#0H[('!R;W9I9&5D(&]N;'D@=&AA="!T:&ES(&YO=&EC92!I
M<R!M86EN=&%I;F5D(&EN=&%C=`T*.PT*.R!697)S:6]N(#`N,3H@:6YI=&EA
M;"!B971A+"!S;R!F87(@;VYL>2!T97-T960@;VX@5VEN9&]W<R`Y-0T*#0I;
M=F5R<VEO;ET-"G-I9VYA='5R93TB)$-(24-!1T\D(@T*4V5T=7!#;&%S<SU"
M05-%#0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

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com



More information about the Cygwin mailing list