In a for loop reading a file line by line i would like to store the input parameter in a variable. In the below example I have reproduced the problem. I try to store %%a to a variable text but the variable remains empty.
if we assume that the file OneLiners.txt contains two lines of text
You won't drink away the alcoholism.
A liberal is just a conservative that hasn't been mugged yet.
and running a script like this
@echo off
for /f "tokens=*" %%a in (OneLiners.txt) do (
set text=%%a
echo %%a
echo %text%
)
will echo
You won't drink away the alcoholism.
ECHO is off.
A liberal is just a conservative that hasn't been mugged yet.
ECHO is off.
Indicating that the variable is empty. How is it possible to assign the content of the parameter to variable? I thought this was the way to do it.