简体   繁体   English

ECHO命令回显仅显示文件的最后一行,而不显示每行

[英]The ECHO command echo only show the last line of my file instead of shows each line

I want to show out of the console each line from a file. 我想从控制台中显示文件中的每一行。 I try this: 我尝试这样:

findstr /v /b /c:" " <%1>toto
for /f "tokens=*" %%a in (toto) do set co=%%a 
echo. %co%

Also this one: 也是这个:

findstr /v /b /c:" " <%1>toto
for /f "tokens=*" %%a in (toto) do (set co=%%a 
echo. %co%
)

But the first way shows me only the last line of file and the second one doesn't show me anything. 但是第一种方法仅显示文件的最后一行,而第二种则不显示任何内容。

Someone can explain me what's wrong in these latter and how to get in the 'co' variable each line printed on the console? 有人可以向我解释后者的问题,以及如何获取控制台上每行显示的'co'变量?

Thanks 谢谢

you override co. 您覆盖公司。 to append to it try set co=%co% %%a 附加到它尝试设置co =%co%%% a

尝试这个:

for /f "tokens=1*delims=:" %%a in ('findstr /n "^" "toto"') do echo %%b

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM