You are here:

WindowsManagement.com > PowerShell > PowerShell 1.0 > Measure-Object
ActiveXperts Network Monitor 2015 proactively manages network servers, devices, databases and more.

Measure-Object - PowerShell 1.0

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.

Measure-Object


Description
Back up your Hyper-V VMs Easy & Fast. 100% built for Hyper-V. Free for 2 VMs, forever.

Usage


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

   -property string[]
       The property to measure.

   -average 
       Average the values in the designated property.

   -sum
       Sum the values of the properties.

   -minimum 
       Determine the minimum value of the properties.

   -maximum 
       Determine the maximum value of the properties.

   -line 
       Count the number of lines in the input object.

   -word 
       Count the number of words in the input object.

   -character
       Count the number of characters in the input object.

   -ignoreWhiteSpace 
       Ignore white space in word counts and character counts.

   CommonParameters:
       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

Example(s)
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