Check if a file or folder exists

1 January 2000 by Snakefoot | Comment » | Trackback Off
It can be useful in batch files to know whether a file or folder exists. One can use files as semaphores and for inter proces communication (IPC).

To check if a file exists:

IF EXIST c:\windows\win.com ECHO File exists!

To check if a directory exists (Notice nul):

IF EXIST c:\windows\nul ECHO Directory exists!

Category:

Updated: 2 July 2007

Leave a comment


You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>