April 24, 2015 at 1:59 pm
I am very new to Powershell and am trying to solve what appears to be a very simple problem.
I have a variable called $TestLocations
The value of $TestLocations is:
xxx
----------
2
23
44
65
I need to extract the values of Lines 3,4,5 & 6 and assign their values to an array. E.g. if I had an array called #x it would look like this:
#x = @((2),(23),(44),(65))
-- Itzik Ben-Gan 2001
April 24, 2015 at 2:30 pm
I figured it out...
$myArray =@()
foreach ($item in $TestLocations) { $myArray += $item.LineNumber }
-- Itzik Ben-Gan 2001
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply