This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: Win 2000 : Open Files With Word & Excel From The Command Line
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/