@echo off @setlocal set countfile="D:\vz\backups\backup_count.txt" @REM file check if not exist %countfile% echo count=0 > %countfile% FOR /F "tokens=1,2 usebackq delims==" %%a IN (`type "%countfile%"`) DO ( if %%a == count set count=%%b @rem if %%a == pass set pass=%%b ) @REM count check if %count%==6 ( set /a count=0 echo count=%count% ) else ( echo count=%count% ) set /a count=%count%+1 echo count=%count% > %countfile%