September 2nd, 2014

PowerTip: Reverse Array with PowerShell

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to reverse an array.

Hey, Scripting Guy! Question How can I use Windows PowerShell to sort an array that is going in the wrong direction?

Hey, Scripting Guy! Answer Call the Reverse static method from the [array] class, for example:

PS C:\> $a = 1,2,3,4,5

PS C:\> [array]::Reverse($a)

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.