This is the mail archive of the cygwin@cygwin.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]
Other format: [Raw text]

Re: Win 2000 : Open Files With Word & Excel From The Command Line


Steve,

Double damn!

Or maybe... Third time's the charm. Yeah, that's it!

-==-
#!/bin/bash

wwArgs=()

for arg; do
wwArgs[${#wwArgs[@]}]="$(cygpath -m "$arg")"
done

exec "/cygdrive/c/Program Files/Microsoft Office/Office/winword.exe" "${wwArgs[@]}"
-==-


Randall Schulz


Steve,

Damn. I forgot the part about converting the argument names from Cygwin / POSIX to Windows.

This is better:

-==-
#!/bin/bash

wwArgs=()

for arg; do
wwArgs${#wwArgs@]}]="$(cygpath -w "$arg")"
done

exec "/cygdrive/c/Program Files/Microsoft Office/Office/winword.exe" "${wwArgs[@]}"
-==-

Note that to use the array syntax you have to use BASH.

This is still somewhat limited, in that it assumes all the arguments to the script are file names. I don't know that WINWORD.EXE accepts anything else, but if it does and you want to use them, this would have to be refined further.

Lastly, I guess there is now some Cygwin-specific aspects to this.

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/


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