Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
To: cygwin@cygwin.com
From: Mark Bohlman <mbohlman@tcicredit.com>
Subject: Re: Problem executing a .bat script in a directory with spaces using bash
Date: Fri, 03 Sep 2004 11:49:02 -0400
Lines: 57
Message-ID: <cha3pd$r9a$1@sea.gmane.org>
References: <5c8adab704090207557a3a359a@mail.gmail.com> <4137566C.7070203@sbcglobal.net> <5c8adab704090210405ea696e4@mail.gmail.com> <413760BD.2080504@sbcglobal.net> <5c8adab70409021123291886c7@mail.gmail.com> <41376CD2.9090102@comcast.net> <41376D75.1060806@comcast.net> <loom.20040903T154613-572@post.gmane.org> <Pine.GSO.4.61.0409030951520.28876@slinky.cs.nyu.edu> <ch9v0q$dda$1@sea.gmane.org> <Pine.GSO.4.61.0409031121250.10783@slinky.cs.nyu.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Complaints-To: usenet@sea.gmane.org
X-Gmane-NNTP-Posting-Host: exchange.tcicredit.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040803
In-Reply-To: <Pine.GSO.4.61.0409031121250.10783@slinky.cs.nyu.edu>
X-Enigmail-Version: 0.85.0.0
X-Enigmail-Supports: pgp-inline, pgp-mime
X-IsSubscribed: yes

Igor Pechtchanski wrote:
> On Fri, 3 Sep 2004, Mark Bohlman wrote:
> 
> 
>>Igor Pechtchanski wrote:
>>
>>>On Fri, 3 Sep 2004, Christopher Cobb wrote:
>>>
>>>
>>>>I get different results than you do.  It seems to work as expected:
>>>>
>>>>chcobb@CHCOBB-054009 /c/Documents and Settings 09:45:46
>>>>511$ cat test.bat
>>>>echo %1
>>>>
>>>>chcobb@CHCOBB-054009 /c/Documents and Settings 09:45:48
>>>>511$ ./test.bat
>>>>
>>>>C:\Documents and Settings>echo
>>>>ECHO is on.
>>>
>>>I believe you're missing the point.  Try
>>>
>>>../test.bat "hello world"
>>>
>>>and you'll get the error.
>>>
>>>I've come across this when writing a pure Windows loader for another
>>>program.  The above is actually an idiosyncrasy of the way spawn() works
>>>in Cygwin (and, incidentally, in Windows' own MSVCRT) -- it calls
>>>CreateProcess, which expects all arguments combined into one command
>>>string (which, in turn, is later parsed for separate arguments - yes,
>>>retarded, I know).  The fact is that, if any argument contains spaces, it
>>>has to be quoted before CreateProcess() is invoked.  Cygwin apparently
>>>doesn't do this properly to the first argument, so the above breaks.  See
>>>spawn_guts() in winsup/cygwin/spawn.cc (warning: a 590!-line function).
>>><http://cygwin.com/acronyms/#PTC>.
>>>	Igor
>>
>>You get the same "odd evaluation behavior" when doing
>>echo "Hello World" | ./test.bat
>>(in any directory).
>>-- Mark
> 
> 
> Actually, I don't.  Did you, by chance, mean "echo ...|xargs ./test.bat"?
> Even so, you should probably be a bit more specific about the "odd
> evaluation behavior" that you're observing.
> 	Igor

Hmmm.  I'm seeing the same results as you show above with a quoted 
"Hello World" parameter to the ./test.bat.

Then in doing the echo, without the xargs, results in the same 
"non-evaluation" (what i consider to be 'odd') for parameter %1 within 
the test.bat file.
-- Mark


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

