@echo off SET file=mes.log SET filename=mes for /f %%a in ('dir /b /a-d %file%') do ( if %%~na==%filename% GOTO :FileFound ) GOTO :FileNotFound :FileFound ECHO FILE FOUND GOTO :BatchEnd :FileNotFound ECHO FILE NOT FOUND :BatchEnd ECHO END
@echo off SET file=mes.log SET filename=mes for /f %%a in ('dir /b /a-d %file%') do ( if %%~na==%filename% GOTO :FileFound ) GOTO :FileNotFound :FileFound ECHO FILE FOUND GOTO :BatchEnd :FileNotFound ECHO FILE NOT FOUND :BatchEnd ECHO END