@echo off call:wordCount 1 2 3 4 5 6 7 8 9 10 42 101 pause>nul exit :wordCount setlocal enabledelayedexpansion set word=100000 set line=0 for /f "delims=" %%i in (input.txt) do ( set /a line+=1 for %%j in (%%i) do ( if not !skip%%j!==true ( echo line !line! ^| word !word:~-5! - "%%~j" type input.txt | find /i /c "%%~j" > count.tmp set /p tmpvar=