This entry has been published on 2017-10-13 and may be out of date.
Last Updated on 2017-10-13.
[:en]Using the command line shell or batch files (.bat), you can easily check if a single file exists.
if exist c:\myfile.txt echo asdf if not exist c:\myfile2.txt echo bsdf
Note the example above does not work with directories or drives! (At least, not on older systems like DOS)
The check would always return false.
Instead, append the important keyword “NUL” to the directory.
if exist c:\mydir\nul echo asdf if not exist d:\nul echo bsdf
This should work in Windows CMD and also in older MS DOS or FreeDOS versions.
[:]