1: 2: 3: 4: 5: 6: 7: 8: 9: 10:
@echo off setlocal enabledelayedexpansion set folder=c:\files for /F %%G in ('dir "%folder%" /A:-D /B') do set /A count+=1 echo %count% pause