delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/09/02/14:59:21

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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: <41376D75.1060806@comcast.net>
Date: Thu, 02 Sep 2004 13:59:01 -0500
From: CyberZombie <Cyber DOT Zombie AT comcast DOT net>
User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Problem executing a .bat script in a directory with spaces using bash
References: <5c8adab704090207557a3a359a AT mail DOT gmail DOT com> <4137566C DOT 7070203 AT sbcglobal DOT net> <5c8adab704090210405ea696e4 AT mail DOT gmail DOT com> <413760BD DOT 2080504 AT sbcglobal DOT net> <5c8adab70409021123291886c7 AT mail DOT gmail DOT com> <41376CD2 DOT 9090102 AT comcast DOT net>
In-Reply-To: <41376CD2.9090102@comcast.net>

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 AT sbcglobal DOT 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/

- Raw text -


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