Measure-Command - PowerShell command help and examples

Measures the time it takes to run script blocks and cmdlets. (Measure-Command)


NAME
Measure-Command
SYNOPSIS
Measures the time it takes to run script blocks and cmdlets.
SYNTAX
Measure-Command [-Expression] <scriptblock> [-InputObject <psobject>] [<CommonParameters>]
DESCRIPTION
The Measure-Command cmdlet runs a script block or cmdlet internally, times the execution of the operation, and returns the execution time.
PARAMETERS
-Expression <scriptblock> Specifies the expression that is being timed. Enclose the expression in curly braces ({}). The parameter name ("Expression") is optional. Required? true Position? 1 Default value Accept pipeline input? false Accept wildcard characters? false -InputObject <psobject> Specifies objects representing the expressions to be measured. Enter a variable that contains the objects or type a command or expression that gets the objects. Required? false Position? named Default value Accept pipeline input? true (ByValue) Accept wildcard characters? false <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For more information, type, "get-help about_commonparameters".
INPUTS
System.Management.Automation.PSObject You can pipe an object to Measure-Command.
OUTPUTS
System.TimeSpan Measure-Command returns a time span object that represents the result.
NOTES
For more information, type "Get-Help Measure-Command -detailed". For technical information, type "Get-Help Measure-Command -full". When specifying multiple values for a parameter, use commas to separate the values. For example, "<parameter-name> <value1>, <value2>".

Examples

EXAMPLE 1
C:\PS>Measure-Command { get-eventlog "windows powershell" }
Description
----------- This command measures the time it takes to run a "get-eventlog" command that gets the events in the Windows PowerShell event log.
EXAMPLE 2
C:\PS>measure-command {get-childitem c:\windows -include *.txt -recurse} Days : 0 Hours : 0 Minutes : 0 Seconds : 8 Milliseconds : 618 Ticks : 86182763 TotalDays : 9.9748568287037E-05 TotalHours : 0.00239396563888889 TotalMinutes : 0.143637938333333 TotalSeconds : 8.6182763 TotalMilliseconds : 8618.2763 C:\PS>measure-command {get-childitem c:\windows -filter "*.txt" -recurse} Days : 0 Hours : 0 Minutes : 0 Seconds : 1 Milliseconds : 140 Ticks : 11409189 TotalDays : 1.32050798611111E-05 TotalHours : 0.000316921916666667 TotalMinutes : 0.019015315 TotalSeconds : 1.1409189 TotalMilliseconds : 1140.9189
Description
----------- These commands show the value of using a provider-specific filter in Windows PowerShell commands. The first command measures the time it takes to process a recursive Get-ChildItem command that uses the Include parameter. The second command measures the time it takes to process a recursive Get-ChildItem command that uses the provider-specific Filter parameter. RELATED LINKS Online version: http://go.microsoft.com/fwlink/?LinkID=113348 Trace-Command Invoke-Command C:\Windows>powershell get-help Update-List -full

Microsoft Windows [Version 10.0.19045.3693]
Copyright (c) 2023 Microsoft Corporation.

ColorConsole [Version 3.7.1000] PowerShell 2.0-Export

Windows 11, 10, 8.1, 8, 7 / Server 2022, 2019, 2016











Windows-10


... Windows 10 FAQ
... Windows 10 How To


Windows 10 How To


... Windows 11 How To
... Windows 10 FAQ



PowerShell: Measures the time it takes to run script blocks and cmdlets.

HTTP: ... PS_Windows/en/Measure-Command.htm
0.171
15450

Why the RAM or memory test for Windows 11, 10, 8.1, ...?  

Does the timer shutdown work with the current MS Windows 11, 10, ...  OS?

Remove search the web box from Windows 10 Taskbar (enable, disable)?

Kann ich meinen Touch Bildschirm auch auf Windows 11 testen?

Why hide the Windows 11, 10, ... mouse pointer or cursor?

Problems when writing under Windows 10. 8.1, ...!



(0)