delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_73,SPF_PASS |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <4A726C93.9090403@gmail.com> |
Date: | Fri, 31 Jul 2009 05:01:23 +0100 |
From: | Dave Korn <dave DOT korn DOT cygwin AT googlemail DOT com> |
User-Agent: | Thunderbird 2.0.0.17 (Windows/20080914) |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Forward slashes in path and pipes |
References: | <h4tnoi$lvr$1 AT ger DOT gmane DOT org> |
In-Reply-To: | <h4tnoi$lvr$1@ger.gmane.org> |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Andrew DeFaria wrote: > Found out a funny thing about Cygwin today. I've known for a while that > forward slashes works as well as backslashes when specifying a path to > execute. So all of the following work from a cmd prompt: > > C:> C:\Cygwin\bin\ls > C:> C:\Cygwin/bin\ls > C:> C:/Cygwin/bin/ls > > Also the following works: > > C:> C:\Cygwin\bin\ls | more > > However the following fails: > > C:> C:\Cygwin/bin\ls | more > > It fails with something like "C:\Cygwin\bin not found" (From memory). > > What does this have to do with Cygwin you say? Nothing. This is cmd.exe's idiosyncratic command-line parsing behaviour. Try quoting it: > C:\Documents and Settings\Administrator>C:\Cygwin/bin\ls | more > 'C:\Cygwin' is not recognized as an internal or external command, > operable program or batch file. > > C:\Documents and Settings\Administrator>"C:\Cygwin/bin\ls" | more > Application Data > Cookies > Desktop > Favorites > Local Settings > My Documents > NTUSER.DAT > NetHood > PrintHood > Recent > SendTo > Start Menu > Templates > default.pls > ntuser.dat.LOG > ntuser.ini > schedlog.txt > > > C:\Documents and Settings\Administrator> For some reason (the presence of the pipe?) cmd.exe parses the forward slash as an options separator rather than a path component in one case but not the other. Quoting removes the ambiguity. cheers, DaveK -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |