PowerTip: Reverse an Array with PowerShell


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)

Comments (0)

Skip to main content