Welcome to the Microsoft Script Center. We are dedicated to the system administrator scripters of the world. At the Microsoft Script Center, we focus on teaching people how to use Windows PowerShell to reduce time spent performing mundane tasks.
Â
What's new?
Check out the Hey, Scripting Guy! blog to catch all the latest news, events, and, of course, scripts!
PowerTip: Counting Characters with PowerShell Summary: Use Windows PowerShell to count characters, words, and lines in a file.
How can I count the number of characters, words, and lines in a text file by using Windows PowerShell?
Use the Measure-Object cmdlet; specify the -Line, -Character, and -Word switched parameters; and use the Get-Content cmdlet to read the text file:
PS C:\> Get-Content C:\fso\ab.txt | measure -Line -Character -Word
Lines Words ...
More >
Saturday, Jul 6