Forrest logo
back to the 10, tool

measure-command:tldr:6031e

measure-command: Pipe input to Measure-Command (objects that are piped to `Measure-Command` are available to the script block that is passed to the Expression parameter).
$ 10, 20, 50 | Measure-Command -Expression { for ($i=0; $i -lt $_; $i++) {$i} }
try on your machine

This command consists of three parts.

The first part, "10, 20, 50", is a list of three numbers. These numbers will be passed as input to the next part of the command.

The second part, "| Measure-Command -Expression { for ($i=0; $i -lt $_; $i++) {$i} }", is a pipeline command that takes the input from the previous part and performs some calculations on it.

The "Measure-Command" cmdlet is used to measure the execution time of a script block. In this case, the script block is "{ for ($i=0; $i -lt $; $i++) {$i} }". The "$" represents the input received from the previous part of the command.

Inside the script block, a "for" loop is used to iterate from 0 to the value of "$_", which is the input number. In each iteration, the loop variable "$i" is printed. Essentially, this script block generates a series of numbers starting from 0 up to the input value.

The "Measure-Command" cmdlet measures the execution time of the script block and returns various properties, such as "TotalMilliseconds", "TotalSeconds", etc.

So, when this command is executed, it takes the input numbers (10, 20, and 50), and for each number, it generates a series of numbers from 0 up to that number. Finally, it measures the execution time for each series.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the 10, tool