Returns number of lines and words (separed by spaces) of a text file dragged to the script. Does'nt count blank lines.
1 2 3 4 5 6 7 8 9 10 | ::counts lines and words in a text file
@echo off
set /a cnt=0,lin=0
for /f "usebackq tokens=*" %%a in (%1) do ( set /a lin+=1
for %%b in (%%a) do set /a cnt+=1
)
echo File: %~nx1 words: %cnt% lines: %lin%
pause
|
Tags: word_count