How do I do a "word count" command in Windows Command Prompt
24,910
Solution 1
find
command could be used in windows cmd to find line count (with the /c
switch), word count etc.
http://rickardnobel.se/counting-lines-in-windows-command-prompt/
Solution 2
The closest I know of is the PowerShell equivalent Measure-Object.
Solution 3
"Find" will be able to do the task similar to word count as RRM told.
Eg.
Query user | find /v /c ""
/v – Show any lines that don’t contain the string of words you specified. /c - Count the number of lines that matches the word in fine.
Query user | find /i "active" /c
/i - Ignore case /c - Count the number of lines that matches the word in fine.
Related videos on Youtube
Comments
-
Nei Mina over 2 years
I know the command in Unix/Linux systems is "wc" but that doesn't work in Windows.
-
Nei Mina almost 8 yearsAwesome! I assume there's a version for 64 bit systems?
-
Sphinx almost 5 yearsPlease add correct tags for your question, like
bash
etc. -
qqqqq about 4 yearsIn this example is it looking for the word "active"? If I look for count of "fail" in "result.txt": Query user | find /i "fail" /c E:\tests\result.txt