X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org X-IronPortListener: Outbound_SMTP Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Subject: RE: Bizarre Cygwin/Explorer/paths problem half-solved Date: Mon, 4 Aug 2008 09:31:30 -0400 Message-ID: <31DDB7BE4BF41D4888D41709C476B6570929B262@NIHCESMLBX5.nih.gov> In-Reply-To: <20080804081811.C6E4585E52@pessard.research.canon.com.au> References: <20080804081811 DOT C6E4585E52 AT pessard DOT research DOT canon DOT com DOT au> From: "Buchbinder, Barry (NIH/NIAID) [E]" To: , "Luke Kendall" X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id m74DWncG010941 Luke Kendall wrote on Monday, August 04, 2008 4:18 AM: > 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. As a work-around, you might try the -x or --explore option of cygstart. I use it in the following script (which I cal "explore"), though a shell function might be better if you use this a lot. ====[ cut ]==== #!/bin/bash /bin/cygstart --explore "${1:-.}" ====[ cut ]==== "${1:-.}" makes explorer open in the current working directory run without an argument. If this does not do what you want, you could always try launching explorer with cygstart (without -x, giving you control of explorer's command line arguments) or cmd /c start. And one way to get rid of spaces is to go to that directory. You could just $ pushd /cygpath/c/temp/space\ dir $ explorer /e,. $ popd Good luck! - Barry - Disclaimer: Statements made herein are not made on behalf of NIAID. -- 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/