批处理读取文本问题

来源:百度知道 编辑:UC知道 时间:2024/08/24 06:40:19
读取文本问题
set n=<t.text
echo %n%
这样每次只能看到t.txt第一行的内容,有什么办法看到所有内容,或是某一行的内容呢?

type 1.txt
more 1.txt
看到所有内容

下面是看指定行内容
@echo off
findstr /n .* 1.txt>>2.txt
set /p a=输入看第几行:
for /f "delims=" %%i in (2.txt) do echo %%i|findstr /b "\<%a%\>"
pause

@echo off
:s
cls
set /p a=输入看第几行:
for /f "tokens=1,* delims=:" %%i in ('findstr /n .* "t.txt"') do if %%i==%a% echo/%%j
pause&goto s