testread.bat
@echo off
setlocal enabledelayedexpansion
set Counter=1
for /f %%i in (test.txt) do (
set "Line_!Counter!=%%i"
set /a Counter+=1
)
set /a NumLines=Counter - 1
echo %Line_1%
echo %Line_2%
echo %Line_3%
echo %Line_4%
echo %Line_5%
echo %Line_6%
pause
test.txt
line 1
line 2
line 3
line - 4
线 - 4
(this line is to purposely try to trip up the reader. just a test)
(这条线是故意试图绊倒读者。只是一个测试)
line 5 -^#^@&
第5行 - ^#^ @&
line 6
line 7
output
line
line
line
line
line
line
press enter to continue (something like that)
按Enter继续(类似的东西)
how would i fix it so the output reads the whole line?
我将如何解决它,以便输出读取整行?
1 个解决方案
#1
4
for /f "DELIMS=" %%i in (test.txt) do (
see for /?
from the prompt for documentation
看/?从提示文件
#1
4
for /f "DELIMS=" %%i in (test.txt) do (
see for /?
from the prompt for documentation
看/?从提示文件