Files
tldr/pages.zh/windows/measure-command.md

13 lines
529 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Measure-Command
> 测量运行脚本块和 cmdlet 所需的时间。
> 注意:此命令只能通过 PowerShell 使用。
> 更多信息:<https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/measure-command>。
- 测量运行命令所需的时间:
`Measure-Command { {{command}} }`
- 将输入传递给 Measure-Command传递给 `Measure-Command` 的对象在传递给 Expression 参数的脚本块中可用):
`10, 20, 50 | Measure-Command -Expression { for ($i=0; $i -lt $_; $i++) {$i} }`