Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

Converting VBScript's Array Function

Windows PowerShell

Definition: Returns a Variant containing an array..


In VBScript it's pretty easy to create an array: all you have to do is dimension a variable as an array, or use the Array function to add multiple values to a variable. Believe it or not, in Windows PowerShell it’s even easier to create an array; all you have to do is assign multiple values to a variable, no special functions or methods are required. For example, this command assigns all the colors of the rainbow to a variable named $a:

$a = "red","orange","yellow","green","blue","indigo","violet"

When you run this command and then echo back the value of $a you should get the following:


Return to the VBScript to Windows PowerShell home page

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft