X-Spam-Check-By: sourceware.org Message-ID: <452D5DF0.9070605@cs.berkeley.edu> Date: Wed, 11 Oct 2006 14:11:12 -0700 From: Johnathon Jamison User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Bash fails to run .bat file with spaces in pathname and argument Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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 Note-from-DJ: This may be spam Hello, I am having some funny behavior. If I have a .bat file that is in a directory whose pathname contains a space, and an argument is given to the .bat file that has a space in it, then the .bat file fails to run. Instead, I get "'xxx' is not recognized as an internal or external command, operable program or batch file." where xxx is the portion of the complete path to the .bat file before the first space. I am not sure why this is occurring. Any help would be appreciated. I have more specific information and a sample run below. If I have left anything out, just ask. In particular, I am not sure which version numbers would be needed, or where to find (many of) them. Thank you for you time, Johnathon To reproduce: 1) The .bat file can contain anything, the problem seems to be before it is ever executed. 2) The .bat file must be in a directory (possibly not a direct parent) whose name contains a space. The actual call to the .bat file does not need to contain a space, provided the program is not called with a pathname that eliminates the space; i.e. Progra~1 vs. Program\ Files. 3) There must be at least on argument containing a space. This argument can be anything, it seems. System: - Setup.exe version 2.510.2.2, update run today, Oct. 11. Mirror ftp://ftp.planetmirror.com. - GNU bash, version 3.1.17(6)-release (i686-pc-cygwin) - Windows XP Professional Version 2002 Service Pack 2 Sample Run: Johnathon AT T60 /cygdrive/c/Program Files/test $ cat foobar.bat echo hi there Johnathon AT T60 /cygdrive/c/Program Files/test $ ./foobar.bat c:\Program Files\test>echo hi there hi there Johnathon AT T60 /cygdrive/c/Program Files/test $ ./foobar.bat ./empty.txt c:\Program Files\test>echo hi there hi there Johnathon AT T60 /cygdrive/c/Program Files/test $ c:/Program\ Files/test/foobar.bat ./empty.txt c:\Program Files\test>echo hi there hi there Johnathon AT T60 /cygdrive/c/Program Files/test $ ./foobar.bat c:/Program\ Files/test/empty.txt 'c:\Program' is not recognized as an internal or external command, operable program or batch file. Johnathon AT T60 /cygdrive/c/Program Files/test $ ./foobar.bat c:/Progra~1/test/empty.txt c:\Program Files\test>echo hi there hi there Johnathon AT T60 /cygdrive/c/Program Files/test $ c:/Program\ Files/test/foobar.bat c:/Program\ Files/test/empty.txt 'c:\Program' is not recognized as an internal or external command, operable program or batch file. Johnathon AT T60 /cygdrive/c/Program Files/test $ c:/Progra~1/test/foobar.bat c:/Program\ Files/test/empty.txt c:\Program Files\test>echo hi there hi there Johnathon AT T60 /cygdrive/c/Program Files/test $ c:/Program\ Files/test/foobar.bat c:/Progra~1/test/empty.txt c:\Program Files\test>echo hi there hi there Johnathon AT T60 /cygdrive/c/Program Files/test $ c:/Progra~1/test/foobar.bat c:/Progra~1/test/empty.txt c:\Program Files\test>echo hi there hi there Johnathon AT T60 /cygdrive/c/Program Files/test $ c:/Program\ Files/test/foobar.bat c:/empty.txt c:\Program Files\test>echo hi there hi there Johnathon AT T60 /cygdrive/c/Program Files/test $ ./foobar.bat c:/Program\ Files/test/qq.txt 'c:\Program' is not recognized as an internal or external command, operable program or batch file. Johnathon AT T60 /cygdrive/c/Program Files/test $ ./foobar.bat random\ argument 'c:\Program' is not recognized as an internal or external command, operable program or batch file. Johnathon AT T60 /cygdrive/c/Program Files/test $ ./foobar.bat "random argument" 'c:\Program' is not recognized as an internal or external command, operable program or batch file. Johnathon AT T60 /cygdrive/c/Program Files/test $ cp foobar.bat c:/ Johnathon AT T60 /cygdrive/c/Program Files/test $ cd ../../ Johnathon AT T60 /cygdrive/c $ ./foobar.bat c:/Program\ Files/test/empty.txt c:\>echo hi there hi there Johnathon AT T60 /cygdrive/c $ -- 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/