This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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

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 Berndl			mailto:
sd&m AG
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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]