PowerTip: Sort a PowerShell Array

Doctor Scripto

Summary: Learn how to easily sort an array of numbers by using Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to easily sort an array of numbers stored in a variable?

Hey, Scripting Guy! Answer Use the Sort static method from the [array] .NET Framework class:

$a = 1,5,3,8,2,12

[array]::sort($a)

0 comments

Discussion is closed.

Feedback usabilla icon