delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/02/14/23:50:18

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
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.20030214204613.0294ea38@pop3.cris.com>
X-Sender: rrschulz AT pop3 DOT cris DOT com
Date: Fri, 14 Feb 2003 20:49:54 -0800
To: cygwin AT cygwin DOT com
From: Randall R Schulz <rrschulz AT cris DOT com>
Subject: Re: Win 2000 : Open Files With Word & Excel From The Command
Line
Mime-Version: 1.0

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


>Steve,
>
>Do your scripts look something like this:
>
>-==-
>#!/bin/sh
>
>exec "/cygdrive/c/Program Files/Microsoft Office/Office/winword.exe" "$@"
>-==-
>
>If they're missing the "$@" part, they're not passing on the arguments 
>you give the script to "winword.exe" or "excel.exe". The "exec" part 
>at the beginning is optional, but definitely recommended in cases like this.
>
>
>Oh, and to satisfy Thorsten: This is scripting 101 stuff and is in no 
>way Cygwin-specific.
>
>
>Randall Schulz
>
>
>At 19:55 2003-02-14, Steve wrote:
>>Hi;
>>
>>I'm on win 2000 and I am using cygwin.
>>
>>I put script files called "word" and "excel" in my /usr/local/bin. 
>>These files have the path to the ms word and ms excel executables.
>>
>>They work, they bring up the apps, but I can't get the apps to take 
>>command line arguments to open remote files.
>>
>>For example:
>>
>>cygwin> word c:/docs/memos/parking/myfile.doc
>>
>>opens only word not "myfile.doc".
>>
>>Is there any way around this?  I would love to be able to do this as 
>>it is monumentally faster then scrolling through a file dialog box or 
>>explorer to open up a file.
>>
>>Thanks
>>
>>Steve


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019