This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Bash fails to run .bat file with spaces in pathname and argument
- From: Johnathon Jamison <jjamison at cs dot berkeley dot edu>
- To: cygwin at cygwin dot com
- Date: Wed, 11 Oct 2006 14:11:12 -0700
- Subject: Bash fails to run .bat file with spaces in pathname and argument
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@T60 /cygdrive/c/Program Files/test
$ cat foobar.bat
echo hi there
Johnathon@T60 /cygdrive/c/Program Files/test
$ ./foobar.bat
c:\Program Files\test>echo hi there
hi there
Johnathon@T60 /cygdrive/c/Program Files/test
$ ./foobar.bat ./empty.txt
c:\Program Files\test>echo hi there
hi there
Johnathon@T60 /cygdrive/c/Program Files/test
$ c:/Program\ Files/test/foobar.bat ./empty.txt
c:\Program Files\test>echo hi there
hi there
Johnathon@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@T60 /cygdrive/c/Program Files/test
$ ./foobar.bat c:/Progra~1/test/empty.txt
c:\Program Files\test>echo hi there
hi there
Johnathon@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@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@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@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@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@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@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@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@T60 /cygdrive/c/Program Files/test
$ cp foobar.bat c:/
Johnathon@T60 /cygdrive/c/Program Files/test
$ cd ../../
Johnathon@T60 /cygdrive/c
$ ./foobar.bat c:/Program\ Files/test/empty.txt
c:\>echo hi there
hi there
Johnathon@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/