PowerTip: Use PowerShell to Reverse Array

Doctor Scripto

Summary: Easily use Windows PowerShell to reverse an array.

Hey, Scripting Guy! Question How can I use Windows PowerShell to reverse an array?

Hey, Scripting Guy! Answer Pipe the array to the Sort-Object cmdlet and use the –Descending switch, for example:

$a = 1,2,3,4,5

$b = $a | sort -Descending

0 comments

Discussion is closed.

Feedback usabilla icon