latest cygwin: 'run' problem

Andrey Repin
Tue Sep 9 14:50:00 GMT 2014

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]

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

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

Andrey Repin ( 09.09.2014, <18:22>

Sorry for my terrible english...

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list