public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cygstart bug: doesn't keep command line arguments intact
       [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]
  0 siblings, 1 reply; 6+ messages in thread
From: John Wiersba @ 2012-08-03 20:02 UTC (permalink / raw)
  To: cygwin

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. 

I couldn't find this reported in the mailing list archives.


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Cygstart bug: doesn't keep command line arguments intact
  2012-08-03 20:02   ` Cygstart bug: doesn't keep command line arguments intact John Wiersba
@ 2012-08-06  1:58     ` Buchbinder, Barry (NIH/NIAID) [E]
       [not found]       ` <1344217063.51063.YahooMailNeo@web161502.mail.bf1.yahoo.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Buchbinder, Barry (NIH/NIAID) [E] @ 2012-08-06  1:58 UTC (permalink / raw)
  To: cygwin, John Wiersba

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Cygstart bug: doesn't keep command line arguments intact
       [not found]         ` <1344217202.72516.YahooMailNeo@web161503.mail.bf1.yahoo.com>
@ 2012-08-06  3:35           ` John Wiersba
  2012-08-06  8:34             ` Adam Dinwoodie
  0 siblings, 1 reply; 6+ messages in thread
From: John Wiersba @ 2012-08-06  3:35 UTC (permalink / raw)
  To: cygwin

Thanks for your reply, Barry.  Yes, it seems that way to me, too.  But that seems wrong.  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.


-- John

P.S. I don't know why, but my reply kept getting rejected as spam by cygwin.org's filters, even though I was using yahoo's "plain text" mode:

  Remote host said: 552 spam score exceeded threshold (#5.6.1) [BODY]

>> From: "Buchbinder, Barry (NIH/NIAID) [E]" <BBuchbinder@niaid.nih.gov>
>> 
>>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.


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Cygstart bug: doesn't keep command line arguments intact
  2012-08-06  3:35           ` John Wiersba
@ 2012-08-06  8:34             ` Adam Dinwoodie
  2012-08-06 14:02               ` John Wiersba
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Dinwoodie @ 2012-08-06  8:34 UTC (permalink / raw)
  To: cygwin

John Wiersba wrote:
>P.S. I don't know why, but my reply kept getting rejected as spam by
>cygwin.org's filters, even though I was using yahoo's "plain text" mode:
>
>  Remote host said: 552 spam score exceeded threshold (#5.6.1) [BODY]

See http://cygwin.com/ml/#spam for how to avoid that.

Also, don't include raw email addresses in your reply quotes -- this is a
publically archived mailing list, and we don't like feeding the spam
harvesters. I suspect (although I have no knowledge of the spam scoring systems
used) that that may be the cause of the rejections. 

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Cygstart bug: doesn't keep command line arguments intact
       [not found]       ` <1344217063.51063.YahooMailNeo@web161502.mail.bf1.yahoo.com>
       [not found]         ` <1344217202.72516.YahooMailNeo@web161503.mail.bf1.yahoo.com>
@ 2012-08-06 13:44         ` Buchbinder, Barry (NIH/NIAID) [E]
  1 sibling, 0 replies; 6+ messages in thread
From: Buchbinder, Barry (NIH/NIAID) [E] @ 2012-08-06 13:44 UTC (permalink / raw)
  To: John Wiersba, cygwin

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Cygstart bug: doesn't keep command line arguments intact
  2012-08-06  8:34             ` Adam Dinwoodie
@ 2012-08-06 14:02               ` John Wiersba
  0 siblings, 0 replies; 6+ messages in thread
From: John Wiersba @ 2012-08-06 14:02 UTC (permalink / raw)
  To: Adam Dinwoodie, cygwin

From: Adam Dinwoodie 

>John Wiersba wrote:
>>P.S. I don't know why, but my reply kept getting rejected as spam by
>>cygwin.org's filters, even though I was using yahoo's "plain text" mode:
>>
>>  Remote host said: 552 spam score exceeded threshold (#5.6.1) [BODY]
>
>See http://cygwin.com/ml/#spam for how to avoid that.
>
>Also, don't include raw email addresses in your reply quotes -- this is a
>publically archived mailing list, and we don't like feeding the spam
>harvesters. I suspect (although I have no knowledge of the spam scoring systems
>used) that that may be the cause of the rejections. 


Thanks, Adam.  I'll remove the raw email addresses.  I am already replying from a subscribed email address.


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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-08-06 13:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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   ` Cygstart bug: doesn't keep command line arguments intact 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 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).