|Something like this?|
for /f "skip=%Line% eol=, tokens=*" %%x in (hostlist.txt) do (
set /a line+=1
If you want to use variables that change in a for loop you must enable delayed variable expansions.
Using %Line% at tokens= would in the end create something like "tokens=317". Your strings do not contain 317 tokens, and you haven't specified any delimiter either, so there is no point in using tokens at all. What you're looking for is probably tokens=*, which means the entire line.
To make it do it once, you can use a break, hence the "goto :break", then the ":break" label after the loop. To save which line it's on, and make it continue from where it left off, you can use "skip=" in the FOR command. For every iteration, %Line% increments by one before breaking, meaning it will resume at the line where it left off.
You should only need to use "setlocal enabledelayedexpansion" once, so I recommend placing the command as early as you can in the script.
Don't worry if plan A fails, there are 25 more letters in the alphabet ;)
message edited by RainBawZ