Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I do a "word count" command in Windows Command Prompt

I know the command in Unix/Linux systems is "wc" but that doesn't work in Windows.

like image 481
Nei Mina Avatar asked Mar 20 '15 23:03

Nei Mina


People also ask

How do you check word count in CMD?

You can also display the Word Count dialog box by pressing Ctrl + Shift + G.

How do you count the number of words in Microsoft Word?

In Microsoft Word the number of words in your document is displayed on the status bar at the bottom left of the workspace. To include text in footnotes, endnotes and text boxes in the word count: From the Review tab, in the Proofing group, click Word Count.

How do I get a list of commands in command prompt?

Windows 8 users can also press ⊞ Win + X and select Command Prompt from the menu. Retrieve the list of commands. Type help and press ↵ Enter . A list of all the available commands will be displayed.


3 Answers

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/

like image 162
RRM Avatar answered Oct 23 '22 16:10

RRM


The closest I know of is the PowerShell equivalent Measure-Object.

like image 23
Alex C. Wolff Avatar answered Oct 23 '22 15:10

Alex C. Wolff


"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.

like image 3
Viggy07 Avatar answered Oct 23 '22 16:10

Viggy07