variable and text file
Posted: 27 Jan 2011 05:47
how to save the text in a text file into a variable as input?
how to set output of a command as a variable?
how to set output of a command as a variable?
Code: Select all
for /f "tokens=*" %%a in ('echo.I like turtles') do set testvar=%%a
echo.%testvar%
Code: Select all
I like turtles
Code: Select all
this is a test on line 1.
this is a test on line 2.
Code: Select all
for /f "tokens=*" %%a in (test.txt) do set testvar=%%a
echo.%testvar%
Code: Select all
this is a test on line 2.
set /p "testvar="<"test.txt"
echo %testvar%
aGerman wrote:There is a small trick to get the first line of a text file.set /p "testvar="<"test.txt"
echo %testvar%
Regards
aGerman
aGerman wrote:There is a small trick to get the first line of a text file.set /p "testvar="<"test.txt"
echo %testvar%
Regards
aGerman