windows 如何使用批处理脚本对目录中的每个文件执行多项操作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2304867/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:59:22  来源:igfitidea点击:

How to do multiple things to each file in a directory with a batch script

windowsbatch-file

提问by Jonah

This is a direct extension of this question:

这是这个问题的直接延伸:

How to do something to each file in a directory with a batch script

如何使用批处理脚本对目录中的每个文件执行某些操作

From the above I leaned how to execute a command for every file in a folder.

从上面我学习了如何为文件夹中的每个文件执行命令。

How do you execute MULTIPLE commands for each file? I want to first use lame to compress the file, then MOVE the original file to a different directory

你如何为每个文件执行 MULTIPLE 命令?我想先用lame压缩文件,然后把原文件移动到不同的目录

This is what I have so far:

这是我到目前为止:

FOR /r cutAndPendingCompression %%f IN (*.*) DO lame %%f compressed\%%~nf -m m -b 16 --vbr-new -V 9 --scale 2.5

采纳答案by Jonah

This did it

这做到了

FOR /r cutAndPendingCompression %%f IN (*.*) DO (
lame %%f compressed\%%~nf -m m -b 16 --vbr-new -V 9 --scale 2.5
move %%f cut\%%~nf
)