- PowerShell Tutorial
- PowerShell - Home
- PowerShell - Overview
- PowerShell - Environment Setup
- PowerShell - Cmdlets
- PowerShell - Files and Folders
- PowerShell - Dates and Timers
- PowerShell - Files I/O
- PowerShell - Advanced Cmdlets
- PowerShell - Scripting
- PowerShell - Special Variables
- PowerShell - Operators
- PowerShell - Looping
- PowerShell - Conditions
- PowerShell - Array
- PowerShell - Hashtables
- PowerShell - Regex
- PowerShell - Backtick
- PowerShell - Brackets
- PowerShell - Alias
- PowerShell Useful Resources
- PowerShell - Quick Guide
- PowerShell - Useful Resources
- PowerShell - Discussion
Powershell - Measure-Object Cmdlet
Cmdlet
Measure-Object cmdlet can be used to get the properties of the passed output such as min, max, size, count, line etc.
In these examples, we're see the Measure-Object cmdlet in action.
Example 1
In this example, first we've a file test.txt in D:\temp\test with content "Welcome to TutorialsPoint.Com".
Type the following command in PowerShell ISE Console
get-content D:\temp\test\test.txt | measure-object -character -line -word
Output
You can see following output in PowerShell console.
Lines Words Characters Property ----- ----- ---------- -------- 1 3 29
Example 2
In this example, We'll count the no. of files present in current directory.
Type the following command in PowerShell ISE Console
Get-ChildItem | Measure-Object
Output
You can see following output in PowerShell console.
Count : 25 Average : Sum : Maximum : Minimum : Property :
powershell_advanced_cmdlets.htm
Advertisements
To Continue Learning Please Login
Login with Google