PowerTip: Create Array with Five Numbers


Summary: Easily create an array that contains five numbers with Windows PowerShell.

 Hey, Scripting Guy! Question How can I use Windows PowerShell to easily create an array that contains five numbers?

Hey, Scripting Guy! Answer Use the Range operator and assign the results to a variable:

$a = 1..5

Comments (2)

  1. Chen V says:

    Helped in manyways!!!

Skip to main content