逐行读取一个txt线在批处理文件 [英] Read a txt line by line in a batch file
问题描述
下面是我的问题。我有100个不同的视频名称(例子)一个txt文件:
Here is my problem. I have a txt file with 100 different video names (examples):
abc.mpg
def.mpg
ghi.mpg
xyz.mpg
我要处理这些影片一个接一个使用一些命令并把结果放到一个文件夹具有相同的名称(不带扩展名):
I want to process those videos one by one using some commands and put the results into a folder with the same name (without the extension):
command1 abc.mpg
command2 abc.mpg
move results .\abc
我的问题是我怎么能以执行上述迭代循环批处理文件中。
My question is how can I perform the above iteration with a for loop within a batch file.
推荐答案
该命令是与/ F参数是这样
The command is FOR with /F parameter like this
FOR /F %i in (yourFile.txt) DO yourcommand %i
这在读取从文本文件中的时间线中插入值到%我的说法
然后调用做关键字后指定的命令(命令可以是另一批与所需的复制或移动操作)
this reads a line at a time from the text file and insert the value into the %i argument Then call the command specified after the DO keyword (the command could be another batch with the copy or move operations required)
这篇关于逐行读取一个txt线在批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!