title: How to assign variables from text file (batch only!)
body: <p>best user, </p>
  
  <p>I tried to assign variables from a txt file in batch. I have a text file called "Final.txt". </p>
  
  <p>Final.txt:</p>
  
  <pre><code>0216027232411405
  02160272b6172505
  1115fb9c6f423305
  1645fb9c6f423305
  0000fb9c6f423305
  </code></pre>
  
  <p>script that I tested till now: </p>
  
  <pre><code>@echo off
  setlocal ENABLEDELAYEDEXPANSION
  set vidx=0
  for /F "tokens=*" %%A in (Final.txt) do (
     SET /A vidx=!vidx! + 1
     set var!vidx!=%%A
  )
  set var
  </code></pre>
  
  <hr>
  
  <pre><code>(
  set /p var1=
  set /p var2=
  set /p var3=
  )&lt;Final.txt
  </code></pre>
  
  <hr>
  
  <pre><code>@echo off 
  setlocal enabledelayedexpansion
  set Counter=1
  for /f %%x in ("Final.txt") do (
    set "Line_!Counter!=%%x"
    set /a Counter+1
    if Counter== 0 goto :EOF
  )
  set /a NumLines=Counter - 1
  echo %Line_1%
  pause 
  
  :EOF
  Echo please connect a device
  pause
  exit
  </code></pre>
  
  <hr>
  
  <p>The problem is that the code works, but it only assign the first line of the text file. I want to assign every line in the text file to a variable.Now I only have 5 devices,but in the future iw till expand to more lines. I will do more research, but if you have a solution. Your answers are always welcome!. If I can figure it out I am going to use it in my other script so you are a life saver. I only want to use batch for this.</p>