delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/09/09/10:50:40

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=tGVS+3cHKK9/2kzX
oKmQHCQMt++4+h5s38CD6OS9C6LdiW2oiam5s/KUL9feb4czQS/O/QaF4bWgMGN4
xvpSulEJWKBxLCr83SFQbH0PvGpmTuQtl1RAVAkZcrzyj1JW+SVT0x576Qm0FTDm
oVnEP0tnzOprL+kikjcP3UkZ1W0=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; s=default; bh=Tf3yxo+n0puheBAQH7C7Uj
6iLR8=; b=ZyaVFkWiqxQ1Jdj6B5sgcqKi7CSLClC4VrgHtTGpD+t0dz+s13Ycf7
fgWChe1Dw555/t5cfT4+Hj0apJfDODZ63xdhCqy8/BZKJJ2sJ9H3+49Cvv0SJFmb
F0tESY1RohTqTBfoA9fFo1MNm0PUobR1Djk/EfbHPyglaPC3DUaYM=
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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=3.5 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_THEBAT,SPF_SOFTFAIL autolearn=no version=3.3.2
X-HELO: smtpback.ht-systems.ru
Date: Tue, 9 Sep 2014 18:41:16 +0400
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: cygwin AT cygwin DOT com
Message-ID: <578633905.20140909184116@yandex.ru>
To: "Buchbinder, Barry (NIH/NIAID) [E]" <BBuchbinder AT niaid DOT nih DOT gov>,
cygwin AT cygwin DOT com
Subject: Re: latest cygwin: 'run' problem
In-Reply-To: <6CF2FC1279D0844C9357664DC5A08BA20EBC4B75@MLBXV06.nih.gov>
References: <87a96hrki4 DOT fsf AT Rainer DOT invalid> <54060378 DOT 2070108 AT gmail DOT com> <5406680D DOT 4030105 AT verizon DOT net> <540761FA DOT 1040902 AT verizon DOT net> <87ppfcqyc7 DOT fsf AT Rainer DOT invalid> <540A600A DOT 6090201 AT verizon DOT net> <540A6817 DOT 9080207 AT verizon DOT net> <20140906201229 DOT GA9220 AT phoenix> <20140908174606 DOT GA4187 AT phoenix> <1448944831 DOT 20140909024857 AT yandex DOT ru> <20140909011413 DOT GC4187 AT phoenix> <836662195 DOT 20140909170801 AT yandex DOT ru> <6CF2FC1279D0844C9357664DC5A08BA20EBC4B75 AT MLBXV06 DOT nih DOT gov>
MIME-Version: 1.0
X-IsSubscribed: yes

Greetings, Buchbinder, Barry (NIH/NIAID) [E]!

> Andrey Repin sent the following at Tuesday, September 09, 2014 9:08 AM
>>That makes little sense. Could be solved, though. CMD doesn't offer a
>>way to distinguish between file and directory, but we have test.

> Every directory contains a virtual file named nul (note: only one L;
> serves the function of /dev/null ), so one can test for that.

> c:\> if exist c:\Windows\nul echo y
> y

> c:\> if exist c:\Windows\explorer.exe\nul echo y

> c:\>

NUL (or NUL:) is a DOS device. You CAN create a file called nul, though. But even then, the test fails.

$ VER & IF EXIST "%SystemRoot%\nul" ( ECHO y ) ELSE ( ECHO n )

Microsoft Windows [Version 6.1.7601]
n

$ ECHO. > "\\.\%SystemRoot%\nul"
$ DIR /B "%SystemRoot%\n*"
nul
notepad.exe
$ IF EXIST "%SystemRoot%\nul" ( ECHO y ) ELSE ( ECHO n )
n

However, you can test for "%~f1\*". But since the behavior is not documented, you can't rely on such test either.


--
WBR,
Andrey Repin (anrdaemon AT yandex DOT ru) 09.09.2014, <18:22>

Sorry for my terrible english...


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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019