I have posted previously about my DR check batch file, but just one issue remains...
I have this code within the batch...
example.txt contains the following line for testing...
\autoexec.bat
The for loop contains; - I changed the FIND to wwwwwwww to force a failure.
set TIB=example.txt
set SERVER=C:
for /f "eol=; tokens=* delims=" %%i in (%TIB%) do (
dir "%SERVER%%%i" | find "wwwwwwww" >nul
if %ERRORLEVEL%==0 (
echo Located - %SERVER%%%i >> %logfile%
) else (
echo ***ERROR*** - %SERVER%%%i, does not exist or incorrect file date >> %logfile%
)
)
For some reason ERRORLEVEL always returns zero even if the file doesn't exist, I'm assuming that's because the FOR command didn't error even though the dir command did.
If I run the DIR command outside the FOR loop it returns errorlevel 1
Does anybody know of a way around this?