读取文件中的N行作为变量,例如第一行作为变量保存:
for /f "delims=" %%i in (c:\test\config\123.txt) do (set test=%%i)&(goto :next)
:next
如果要指定第N行,可以用变量来即可:
for /f "skip=N-1 "delims=" %%i in (c:\test\config\123.txt) do (set test=%%i)&(goto :next)