If I have data file.txt
and I want to read data from开发者_C百科 it into variable by using the command : set
How can I do that?
How can I move one line to another?Read two lines from a file, based on your comments:
@echo off
setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in (file.txt) do (
set /a N+=1
set v!N!=%%a
)
set sn=!v1!
set s=!v2!
You may want to consider using a scripting language, if you want to process multiple lines.
This will give you line one in the variable:
@echo off
set /p var=<file.txt
echo "%var%"
pause
精彩评论