This is the mail archive of the cygwin@sources.redhat.com 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]

RE: Ultimative way to start Windows 95/98/NT/2000 programs from b ash


Hi Klaus,

My be you should remove now 95 and 98 from the subject <g>. What about other
executables or script files identified by PATHEXT ?

Greetings,
Jörg

> -----Original Message-----
> From: klaus.berndl@sdm.de [mailto:klaus.berndl@sdm.de]
> Sent: Monday, November 13, 2000 1:20 PM
> To: cygwin@sourceware.cygnus.com
> Subject: AW: Ultimative way to start Windows 95/98/NT/2000 
> programs from
> b ash
> 
> 
> OK, here comes my last version of this way, this avoids all 
> the problems
> you have mentioned:
> 
> function open-file-with-w32 () {
>     erg=""
>     for i in $*; do
>         if [ -f "$i" ]; then
>             # get the extension only
>             erg=`echo $i | sed -e 's|.*\.||g;'`
>             # check if we try to open a bat or cmd file
>             if [ "$erg" != "bat" ] &&
>                [ "$erg" != "BAT" ] &&
>                [ "$erg" != "cmd" ] &&
>                [ "$erg" != "CMD" ]; then
>                 # check if this extension is associated with 
> a w32-program
>                 erg=`cmd /c assoc ".$erg" 2>/dev/null`
>                 if [ "$erg" != "" ]; then
>                     # an associtiation exists therefore this call
>                     # should theoretically not produce an error.
>                     cmd /c start /b `cygpath -w "$i"` 2>/dev/null
>                 else
>                     # we must start the file with a text editor
>                     emacs `cygpath -w "$i"`
>                 fi
>             else
>                 emacs `cygpath -w "$i"`            
>             fi
>         fi
>     done
>     unset erg; }
> alias o=open-file-with-w32
> 
> Now you can open all filetypes with their associated program and if no
> association exists it will be opened with the text editor (here emacs)
> 
> Hope this helps,
> Klaus

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


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