在FOR循环中使用什么定界符读取行? [英] What delimiter to use in FOR loop for reading lines?

查看:82
本文介绍了在FOR循环中使用什么定界符读取行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个txt文件,其中包含以下几行

I have a txt file that contains the following lines

jfo3 93jfl
lvls 29fdj
nskd jfuwe
xlkw eklwe

我正在尝试逐行读取文件,并对其进行处理.我应该使用什么定界符?

I'm trying to read the file line by line, and do something with it. What delimiter should I use?

我在这里使用的delim分别读取每个单词.

The delim I'm using here reads each word separately.

@echo off
setlocal EnableDelayedExpansion
for /f "delims=" %%x in (lines.txt) do (
    echo %%x
)

推荐答案

这对我来说是逐行读取的:

This reads line by line for me:

for /f "delims=" %x in (lines.txt) do echo %x

这篇关于在FOR循环中使用什么定界符读取行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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