Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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: <5c8adab70409021123291886c7@mail.gmail.com> Date: Thu, 2 Sep 2004 14:23:53 -0400 From: Sean Daley Reply-To: Sean Daley To: cygwin AT cygwin DOT com Subject: Re: Re: Problem executing a .bat script in a directory with spaces using bash In-Reply-To: <413760BD.2080504@sbcglobal.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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> X-IsSubscribed: yes 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 ./test.bat "hello world" '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 This just doesn't seem right to me. Sean On Thu, 02 Sep 2004 11:04:45 -0700, GD 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/