1.

Solve : How to judge whether the specified directory or file exists or not??

Answer»

Hi All:

In BATCH programming, how to judge whether the specified directory or file exists or not? Thanks a lot in advance!check the EXIST part of IF - do IF /? at the command PROMPT ... it works for directories tooCould you please paste some code snippet? Thanks!Quote

IF EXIST FILENAME. echo found filename.
ELSE echo filename. missing
Hello,

if exist C:\Test\nul echo It is there

will make an output "It is there" when the directory is present.


if not exits C:\Test\nul echo Dir not found

will make an output "Dir not found" when the directory ist not present.


Instead of "nul" you can use filenames, too.

Ciao.



Brain


Discussion

No Comment Found