Measure-Command
Measures the time it takes to run script blocks and cmdlets.
语法
Default (默认值)
Measure-Command
[-InputObject <PSObject>]
[-Expression] <ScriptBlock>
[<CommonParameters>]
说明
The Measure-Command
cmdlet runs a script block or cmdlet internally, times the execution of the operation, and returns the execution time.
参数
-Expression
Specifies the expression that is being timed. Enclose the expression in braces ({}). The parameter name ("Expression") is optional.
参数属性
类型: | ScriptBlock |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | 0 |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-InputObject
Objects bound to the InputObject
parameter are optional input for the ScriptBlock
passed to the Expression
parameter.
Inside the ScriptBlock
, $_
can be used to reference the current object in the pipeline.
参数属性
类型: | PSObject |
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | True |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
输入
PSObject
You can pipe an object to Measure-Command
.
输出
TimeSpan
Measure-Command
returns a time span object that represents the result.