开发者

How to read data file?

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜