Hi, I often use the below type of loop in batch files.
for /f %%a in (file.csv) do echo %%acan anyone help me converting this into a powershell script?
I have googled but not had much luck, i am new to powershell and need help with this is anyone can offer it? It would be much appreciated.
TIA
If anyone is reading this I managed to sort this by doing the following $file = "C:\file.csv" $macs = Get-Content $file | foreach{$_.split(",")} foreach ($mac in $macs) { write-output $mac | out-file -filepath "C:\file2.txt" -append }I know this seems silly, taking one file and putting it into another but for illustration it is good, in the foreach loop you can do anything with the $mac variable
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |