I have a problem with setting each line of a txt file to a variable. All the variables have a blank value, whichever method I try. The txt file (Input.txt)contains this:
Code: Select all
Panda Hello
Icebear Hey
Code: Select all
setlocal enabledelayedexpansion
set Counter=1
for /f %%x in (Input.txt) do (
set "Line!Counter!=%%x"
set /a Counter+=1
)
echo %Line1%
Code: Select all
setlocal enabledelayedexpansion
for /f "usebackq tokens=*" %%A in ("Input.txt") do (
set /a N += 1
set "Line!N!=%%A"
)
echo %Line1%
Code: Select all
setlocal EnableDelayedExpansion
<"Input.txt" (
for /f %%i in ('type "Input.txt" ^| find /c /v ""') do set /a n=%%i && for /l %%j in (1 1 %%i) do (
set /p "line_%%j="
)
)
for /l %%i in (1 1 !n!) do echo(!line_%%i!
Any help would be awesome, thank you