开发者

How to read data file?

开发者 https://www.devze.com 2023-02-03 16:30 出处:网络
If I have data file.txt and I want to read data from开发者_C百科 it into variable by using the command :set

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

精彩评论

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