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
Message-ID: <41376D75.1060806@comcast.net>
Date: Thu, 02 Sep 2004 13:59:01 -0500
From: CyberZombie <Cyber.Zombie@comcast.net>
User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: Problem executing a .bat script in a directory with spaces using bash
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>
In-Reply-To: <41376CD2.9090102@comcast.net>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I typed too soon...

/c/Documents and Settings>./test.bat "Hello world"
'c:\Documents' is not recognized as an internal or external command,
operable program or batch file.

CyberZombie wrote:

> I don't get that behavior...
>
> ~>cd /c/Documents\ and\ Settings
> /c/Documents and Settings>cat test.bat
> @echo %1
> /c/Documents and Settings>./test.bat Hello world
> Hello
> /c/Documents and Settings>ls -l test.bat
> -rwxr-xr-x    1 Rob      None            8 Sep  2 13:53 test.bat
> /c/Documents and Settings>
>
> Sean Daley wrote:
>
>> The problem is, there's nothing for me to quote here.  It's not like
>> the batch script fails to
>> give me the correct information (due to incorrect quoting).  The
>> script fails to even
>> LAUNCH when it lives in a directory with spaces and you pass in an 
>> argument with
>> a space in it.  Mind you, I've changed directory to that directory
>> with spaces so I'm
>> not trying to do something like:
>> "/cygdrive/c/Space \Dir/test.bat" "hello world"
>>
>> cd /cygdrive/c/Space\ Dir
>> ./test.bat hello
>> <works just fine>
>>
>> ./test.bat "hello world"
>> <fails with:>
>> 'c:\Space' is not recognized as an internal or external command,
>> operable program or batch file.
>>
>> And all test.bat does is echo %1
>> change test.bat to do just echo (so it doesn't even process its 
>> arguments)
>> and it still fails accordingly.
>>
>> Let me just give one final example (this time test.bat says echo %*)
>>
>> $ /cygdrive/c/Space\ Dir/test.bat hello
>> c:\Space Dir>echo hello
>> hello
>> $ /cygdrive/c/Space\ Dir/test.bat hello world
>> c:\Space Dir>echo hello world
>> hello world
>> $ /cygdrive/c/Space\ Dir/test.bat "hello world"
>> 'c:\Space' is not recognized as an internal or external command,
>> operable program or batch file.
>>
>> I'm running the exact same command all three times with different 
>> arguments.
>> The minute I pass a quoted argument (with spaces) to the batch script 
>> though,
>> bash itself complains about not being able to find test.bat.
>>
>> Now let's take this one step further.  In the last case, it actually
>> thinks it wants
>> to execute C:\Space instead of the script.  Now let's do the following:
>> Create a batch script called "C:\Space.bat" and put one line into it.
>> cat /etc/passwd.
>>
>> Now re-run the third command again:
>> $ /cygdrive/c/Space\ Dir/test.bat "hello world"
>> c:\Space Dir>cat /etc/passwd
>> <etc/passwd file is now displayed>
>>
>> This just doesn't seem right to me.
>>
>> Sean
>>
>> On Thu, 02 Sep 2004 11:04:45 -0700, GD <d1945@sbcglobal.net> wrote:
>>  
>>
>>>> ...
>>>> I apologize for making that false assumption.
>>>>
>>>> Thanks.
>>>>
>>>> Sean
>>>>
>>>>     
>>>
>>> Sorry for sounding rude, but admittedly I was a bit terse. :-)  Your
>>> post raised simple shell quoting issues and nothing else. Honeslty, I'm
>>> not understanding the problem as you're describing it, but if spaces in
>>> a file/directory name is causing an issue, then why wouldn't the simple
>>> use of single quoting (for example) to prevent shell expansion not 
>>> solve it?
>>>
>>>
>>>   
>>
>>
>> -- 
>> 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/
>>
>>
>>  
>>
>
>
> -- 
> 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/
>
>


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

