Ultimative way to start Windows 95/98/NT/2000 programs from bash

klaus.berndl@sdm.de klaus.berndl@sdm.de
Fri Nov 10 16:19:00 GMT 2000


the following method to start w32-program avoids a minor bug in bash: if
you start a w32-gui-program in the background from bash and then exit the
started program bash eats up almost all cpu-power until you hit RET at bash so
the message "...Done" occurs. (This bug was discussed a lot some time ago)
 Therfore we use the NT cmd.exe to start such programs.

Here comes what i have done for me in my .bashrc:

# opens a registered file-type (see commands assoc and ftype at
#  Windows NT) with the associated program.
function open-w23-registered-file-types () {
    for i in $*; do
        cmd /c start /b `cygpath -w "$i"`
    done; }

alias o=open-w23-registered-file-types 

Then you can open any registered file-type with a command like:

o file1.txt ~/worddata/*.doc file2.xls

This would open file1.txt in my NTEmacs, all word-documents in Winword and
file2.xls in Excel.

BTW: One of the greated advantages of this method is, that all files of the same type are opened
in the **same** instance of the related program. 
In contrast to that opening a word document (.doc) with a call like

winword <filename>.doc &

always starts a new instance of word!!

Hope this is useful for someone else,
Klaus


-- 
Klaus Berndl			mailto: klaus.berndl@sdm.de
sd&m AG			http://www.sdm.de
software design & management	
Thomas-Dehler-Str. 27, 81737 München, Germany
Tel +49 89 63812-392, Fax -220


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



More information about the Cygwin mailing list