PowerTip: Reverse an Array with PowerShell

Doctor Scripto

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)

0 comments

Discussion is closed.

Feedback usabilla icon