Measure the numeric or string properties of objects

      Measure-Object [ [-property] string[] ]  [-inputObject psobject]
         [-average] [-sum] [-minimum] [-maximum]

      Measure-Object [ [-property] string[] ]  [-inputObject psobject]
         [-character] [-line] [-word] [-ignoreWhiteSpace]

       The objects to be measured. 
       A command, expression or variable that contains the objects.

   -property string[]
       The property to measure.

       Average the values in the designated property.

       Count the number of characters in the input object.

       Ignore white space in word counts and character counts.

       Count the number of lines in the input object.

       Determine the minimum value of the properties.

       Determine the maximum value of the properties.

       Sum the values of the properties.

       Count the number of words in the input object.

       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable,
       -OutBuffer -OutVariable.

Standard Aliases for Measure-Object: measure

In PowerShell 3.0 it is possible to measure Date/Time properties such as LastWriteTime of a file or StartTime of a process.


Count the number of files and folders in the current directory:

PS C:\> get-childitem | measure-object

Display the size of the largest and the size of the smallest file in the current directory:

PS C:\> get-childitem | measure-object -property length -minimum -maximum

Count the number of words in the file SS64.txt

PS C:\> get-content C:\SS64.txt | measure-object -word

“The advantage of living is not measured by length, but by use; some men have lived long, and lived little; attend to it while you are in it” ~ Michel Eyquem de Montaigne


Compare-Object - Compare the properties of objects
ForEach-Object - Loop for each object in the pipeline
Group-Object - Group the objects that contain the same value for a common property
New-Object - Create a new .Net object
Select-Object - Select objects based on parameters set in the Cmdlet command string
Sort-Object - Sort the input objects by property value
Tee-Object - Send input objects to two places
Where-Object - Filter input from the pipeline allowing operation on only certain objects
Equivalent bash command: expr - Evaluate expressions

© Copyright 1999-2015
Some rights reserved