Test if a directory exists

To test for the existence of a directory, test for the existence of he file nul.ext in it.
Warning: the filename nul may be sufficient on a standard FAT system, but not on a Novell network, a NTFS patition,...

ex: if exist c:\mydir\nul.ext echo The directory 'MYDIR' exists.