我正在尝试使用批处理从文本文件中读取每一行。
文件中的行有一些空格,所以这是一个输入示例:
This is the first line
This is the second line
...
我正在使用以下源代码
FOR /f %%a in ("%1") do (
@echo %%a
)
goto:eof
输出如下:
This
This
...
我已阅读 Stack Overflow 中的以下条目,但并未解决我的问题。 Batch : read lines from a file having spaces in its path
最佳答案
试试这个。
FOR /f "tokens=* delims=," %%a in ('type "%1"') do (
@echo %%a
)
关于windows - 使用批处理从文件中读取带有空格的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13013378/