Batch file in Windows 7.
I want to know how to test for a path + file name with an extension, if it exists or not.
I have tried if exists "myfile.ext" It seems not to see the file.
Your help is appreciated.
The correct command is EXIST
, not "exists".
From if /?
:
EXIST filename Specifies a true condition if the specified filename
exists.
Example:
if exist "myfile.txt" echo Found!
And you can just add a path as needed:
if exist "c:\Some folder\myfile.txt" echo Found!