Check folder is empty using batch command?
for /F %%i in ('dir /b "C:\Program Files\Apache folder\*.*"') do ( echo Folder is NON empty goto launch_app ) How to check a folder is empty? I tried above command, but it didn't work. try this: for /F %%i in ('dir /b /a "C:\Program Files\Apache folder\*"') do ( echo if you see this the folder is NOT empty goto launch_app ) File Not Found @for /f "tokens=*" %%a in ('dir /b /a-d "C:\Progra~1\Apache"') do @... The error that you see when you run this command, comes for the standard error output. But that is only a warning printed to your console. When this case happens, the body of the iteration