Hi all, thanks for any help on this one, been scratching my head and google'ing but found nothing so far. (I'm new to powershell, so I might be looking in the wrong area)
I have a normal .txt (no headers) that has 10 lines of text, I'm trying to get that to import into an array, and (later on) be able to be selectable via a menu system.
So far, I have the following code;
$DDGName =Get-Content "C:\Temp\ImportTest\Import.txt"
$DDGArray = $DDGName
$RecordNumber =0
foreach ($DDGName in $DDGArray)
{
Write-output $DGGArray[$RecordNumber] $RecordNumber
write-output $DDGName $RecordNumber
$RecordNumber ++
}
The main issue I have currently, is that it's importing the content of the file, and the file name as a string. So the output is.
C
0
Line 1
:
1
Line 2
\
2
Line 3
As you can see (Line 1 of the output is the file path - Marked in bold)
Line 2, is fine it's the array number (Which I've yet to translate to a selectable menu option)
Line 3 is the line of text in the file, which is, of course, expected and desired.
How can I keep the array content, but not the file string content?
Thanks.