November 1st, 2015

PowerTip: Reverse an Array with PowerShell

Doctor Scripto
Scripter

Summary: Learn how to reverse an array with Windows PowerShell.

Hey, Scripting Guy! Question How can I use Windows PowerShell to reverse the order of an array stored in a variable?

Hey, Scripting Guy! Answer Use the static reverse method from the Array class, for example:

$a = @(1,2,3)

[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.

Feedback