public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Buchbinder, Barry (NIH/NIAID) [E]" <BBuchbinder@niaid.nih.gov>
To: John Wiersba <jrw32982@yahoo.com>,
	"cygwin@cygwin.com" <cygwin@cygwin.com>
Subject: RE: Cygstart bug: doesn't keep command line arguments intact
Date: Mon, 06 Aug 2012 13:44:00 -0000	[thread overview]
Message-ID: <0105D5C1E0353146B1B222348B0411A20A954E0E15@NIHMLBX02.nih.gov> (raw)
In-Reply-To: <1344217063.51063.YahooMailNeo@web161502.mail.bf1.yahoo.com>

John Wiersba wrote on August 05, 2012 9:37 PM
>I would think that cygstart should pass arg1 as arg1 to the specified command (winword.exe in my example).  That's certainly the way it works in the unix/linux world and cygstart should be considered as an (emulated) unix command, right?  If cygstart were a Windows command I would expect such behavior, but from an (emulated) unix/linux command, I expect the arguments to be kept intact.
>In any case, it makes it awkward to run the command I mentioned, because I have to parse the arguments myself and perform awkward substitutions on them.

Have you considered the following?

cygstart "a b c.doc"

Unless you've reset the default application for doc files, Windows will see the doc file extension and pass the file to winword.

And the following might even work (untested), which lets one take advantage of file name completion.

cygstart a\ b\ c.doc

Or how about a script?  (untested)

#!/bin/bash
for WrdDoc in "$@"; do cygstart /path/winword.exe "\"${WrdDoc}\"" ; done

Unrelated:  Not that I mind, but this list is very anti-top-posting. you are forewarned.

- Barry
  Disclaimer:  Statements made herein are not made on behalf of NIAID.


________________________________
From: "Buchbinder, Barry (NIH/NIAID) [E]"
Sent: Sunday, August 5, 2012 2:38 PM
Subject: RE: Cygstart bug: doesn't keep command line arguments intact

John Wiersba wrote August 03, 2012 3:18 PM
>Calling              /c/program\ files/microsoft\ office/office12/winword.exe "a b c.doc" works.
>Calling cygstart /c/program\ files/microsoft\ office/office12/winword.exe "a b c.doc" tries to open a.doc, b.doc, and c.doc.

In the first, bash strips the quotes and passes <a b c.doc> to winword as arg1.

In the second, bash strips the quotes and passes <a b c.doc> to cygstart as arg1.
cygstart then passes <a>, <b>, and <c.doc> to winword as arg1, arg2, and arg3.

At least that is the way I understand it.
Subject to correction by the more knowledgeable.

So try protecting your double quotes with single quotes.  E.g. '"a b c.doc"'.
I don't know if the double quotes get passed to winword, but there is a lesser
chance that single quotes will work if they are on the inside, I doubt MS ever
treats them as special.

Good luck.

- Barry
  Disclaimer:  Statements made herein are not made on behalf of NIAID.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

      parent reply	other threads:[~2012-08-06  9:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1344017509.70947.YahooMailNeo@web161502.mail.bf1.yahoo.com>
     [not found] ` <1344020282.97348.YahooMailNeo@web161504.mail.bf1.yahoo.com>
2012-08-03 20:02   ` John Wiersba
2012-08-06  1:58     ` Buchbinder, Barry (NIH/NIAID) [E]
     [not found]       ` <1344217063.51063.YahooMailNeo@web161502.mail.bf1.yahoo.com>
     [not found]         ` <1344217202.72516.YahooMailNeo@web161503.mail.bf1.yahoo.com>
2012-08-06  3:35           ` John Wiersba
2012-08-06  8:34             ` Adam Dinwoodie
2012-08-06 14:02               ` John Wiersba
2012-08-06 13:44         ` Buchbinder, Barry (NIH/NIAID) [E] [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0105D5C1E0353146B1B222348B0411A20A954E0E15@NIHMLBX02.nih.gov \
    --to=bbuchbinder@niaid.nih.gov \
    --cc=cygwin@cygwin.com \
    --cc=jrw32982@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).