Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-Id: <5.2.0.9.2.20030219135643.02c2eb50@pop3.cris.com> X-Sender: rrschulz AT pop3 DOT cris DOT com Date: Wed, 19 Feb 2003 14:01:50 -0800 To: cygwin AT cygwin DOT com From: Randall R Schulz Subject: Re: Win 2000 : Open Files With Word & Excel From The Command Line In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Steve, If you have or are willing to install the cygutils package, then cygstart is indeed the preferred way to deal with this general problem. However so that you'll be able to do comparable scripting when cygstart isn't an option, I'll point out where you went wrong--it's all erroneous BASH syntax. See below. At 13:46 2003-02-19, Steve wrote: >Hi; > >I managed to get my script "word" to open up word with the path I >typed on the command line in cygwin. > >I am having trouble getting the same to work with excel. > >I am win 2000 and using cygwin. > >I made a script in /usr/local/bin called "excel". > >The script will boot up excel, but not with the file I specified. I >get error messages saying that the file does not exist. Between the >"===" lines are the different contests I have tried for my "excel" script: > > >version 1 >============================================================ >exec "c:/Program Files/Microsoft Office/Office/EXCEL.EXE" "cygpath -w $1" You're not invoking cygpath here, you're just creating a single argument to EXCEL.EXE that is composed of "cygpath -w " plus whatever was argument one to the script invocation. This is what you want instead: exec "c:/Program Files/Microsoft Office/Office/EXCEL.EXE" "$(cygpath -w $1)". >=========================================================== >version 2 >exec "c:/Program Files/Microsoft Office/Office/EXCEL.EXE" "@&" In order to get each argument individually quoted (exactly what's called for in this case), the BASH syntax is: exec "c:/Program Files/Microsoft Office/Office/EXCEL.EXE" "$@" This a special case of the general BASH array referencing syntax, which is byzzantine. Please refer to the BASH documentation see it in its full glory. >Usage: > >$ word /path/to/file.xls > >Any ideas would be appreciated > >Thanks > >Steve Randall Schulz -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/