i have a .txt file that has a list of numbers formatted like this:
1010
1020
1030
and I need PowerShell to set a variable to the first line, then set that same variable to the second line and so on.
I used something like this:
$num = Get-Content D:bruteforcelist.txt | Select -first 1 | Select -first 1
And it works when it does the first number, but when it does the second line it sets the variable $num to the first 2 lines instead of only the second line by itself. so I just need something like this but it sets the variable to the first line then ONLY the second line and so on so if i had this list:
1
2
3
So it wound set the $num variable to 1 then 2 then 3, then add another variable to the end, so if i had a $word variable that was set to “hello” it would set the $num variable to:
1hello
2hello
3hello
coding_101 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.