Collections:
Other Resources:
Array in Windows PowerShell Scripts
What is an array in Windows PowerShell scripts?
✍: FYIcenter.com
An array in Windows PowerShell is a simple data structure where
pieces of data are stored in as elements in the structure in an ordered sequence.
In an array, each element can be identified by the sequence index.
You can create an array of objects by listing its elements using the @(...) syntax as shown below:
@(data1,data2,data3,...)
For example, the following script creates an array of String objects and assign it to variable $w:
$w = @("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
"Week Days:"
$w
You can access a member of an array variable using the "[n]" operation, where "n" is the sequence index where the member is located in the array:
$w = @("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
"First day of the week is "+$w[0]
"Last day of the week is "+$w[6]
⇒ Loop Array Elements in Windows PowerShell Scripts
⇐ Execution Loops in Windows PowerShell Scripts
2016-10-29, ∼3711🔥, 0💬
Popular Posts:
How to use sc.exe command to create a new service? If you want to create a new service, you can use ...
What is the "csrss.exe" process on windows 7? Is the "csrss.exe" process a virus? Can I terminate th...
the computer detect the microphone plugged in, but it's not working with any App. or Desktop soft we...
What is tfswctrl.exe process - Sonic Drive Letter Access Component? Process tfswctrl.exe is the Driv...
Can I remove startup application "reader_sl.exe - Adobe Acrobat Reader Speed Launch" to speedup my c...