This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bizarre Cygwin/Explorer/paths problem half-solved


I discovered today that if I try to run Windows Explorer from the Cygwin
command line, and give it a pathname with spaces, it fails, but if I
give the same command line to a cmd.exe command line, Explorer works!

I.e. from Bash, explorer fails with an error message like
"The path '/e,c:\temp\space dir' does not exist or is not a directory."

I've tried every quote combo I can.  If I leave off the /e option then
it does open the directory, but without the side pane (which is what
you'd expect with the /e option omitted).

Bash shell:

    $ mkdir c:/temp/"space dir"

    $ explorer /e,c:\\temp\\space\ dir
    $ # NBG^
    $ explorer /e,c:\\temp
    $ # GOOD^
    $ explorer c:\\temp\\space\ dir
    $ # GOOD^ (but no side pane)
    $ explorer /e,"c:\temp\space dir"     
    $ # NBG^
    $ explorer /e,"\"c:\temp\space dir\""
    $ # NBG^

DOS shell:

    c>explorer /e,c:\temp\space dir
    c>rem  GOOD^
    c>explorer /e,"c:\temp\space dir" 
    c>rem  GOOD^
    c>explorer /e,'c:\temp\space dir' 
    c>rem  NBG^
    c>explorer /e,c:\temp\space dir
    c>rem  NBG^

Until I tried the same stuff under the DOS shell, I assumed it was
explorer.exe that was busted.  Now I'm just confused.

I find this quite bizarre.  Any suggestions?  Is bash or Cygwin
guessing the /e option is part of a path, and doing some extra quoting
of its own or something?

I just tried an strace on bash, and it looks like this guess is correct:

  140 4166625 [main] bash 5696 spawn_guts: null_app_name 0
   (c:\WINDOWS\explorer.exe, c:\WINDOWS\explorer.exe "/e,c:\temp\space dir")

It's collected all the arguments and put them inside double quotes, and
if I do that in a DOS shell too I get the exact same failure.

If the directory contains no spaces, then bash does this, in contrast:

12217 33394057 [main] bash 5284 spawn_guts: 5284 = spawn_guts
 (/cygdrive/c/WINDOWS/explorer, c:\WINDOWS\explorer.exe /e,c:\temp)

Is there some way to tell Bash/Cygwin not to do this?  Or is it simply
that my bash is too old?

$ bash --version
GNU bash, version 3.2.9(10)-release (i686-pc-cygwin)
Copyright (C) 2005 Free Software Foundation, Inc.

Regards,

luke

PS: NBG = No Good!



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]