阅读与空格行从文件中使用批处理 [英] Read lines with blank spaces from a file using batch

查看:111
本文介绍了阅读与空格行从文件中使用批处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图读取使用批处理文本文件中的每一行。

I'm trying to read each line from a text file using batch.

该文件中的行拥有的一些空格,所以这是输入的例子:

The lines inside the file has some blank spaces, so this is an example of the input:

This is the first line
This is the second line
...

我用下面的源$ C ​​$ C

I'm using the following source code

FOR /f %%a in ("%1") do (
    @echo %%a
)
goto:eof

的输出是follwing:

The output is the follwing:

This
This
...

我已经阅读栈溢出下面的条目,但并没有解决我的问题。
<一href=\"http://stackoverflow.com/questions/4389923/batch-read-lines-from-a-file-having-spaces-in-its-path\">Batch :阅读有其路径中空格的文件行

请,你能帮助我解决这个问题?

Please, could you help me with this issue?

先谢谢了。

推荐答案

试试这个。

FOR /f "tokens=* delims=,"  %%a in ('type "%1"') do (
    @echo %%a
)

这篇关于阅读与空格行从文件中使用批处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆