@echo off color 02 setlocal set _folder="C:Demo" for /F %%A in ('dir /b /a %_folder%') Do ( Echo The folder is NOT empty pause goto exit ) echo The folder is empty pause goto exit :exit exit