PowerTip: Create Array with Five Numbers

PowerTip: Create Array with Five Numbers

  • Comments 2
  • Likes

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

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Cool tip, thanks!

  • Helped in manyways!!!