How to catch "The system cannot find the file" within For /F loop
?
I would like my code to do the following:
- 1 - Search for the specified file
- 2 - If file not found, handle the "The system cannot find the file" by sleeping for 10 seconds and repeating the search
- 3 - If the file is found (it will be added to the directory eventually), continue with the script
Current code for search:
FOR /F "tokens=* delims=" %%x IN (D:\batch\logs\mylog_%1.log) DO (
SET content=%%x & ECHO !content!
)
%1
is my input parameter once called via .bat script