Count

Used to count and can do more:

Measure-Object

Print only the count of files in the current dir:

write-host (Get-ChildItem | Measure-Object).count

Count unique entries in a file:

Get-Content .\testing.txt | Sort-Object -Unique | Measure-Object

Find the 161st word in a file. (Remember: Starts at '0'):

((Get-Content .\Word_File.txt).split(" "))[160]

Last updated

Was this helpful?