批处理子文件夹中包含 sox 的 wav 文件
我有一个批处理脚本文件,将现有wav
文件转换为单声道文件,称为“ mono”
code
@echo off && cd /d "%~dp0"
2>nul mkdir "Mono"
set "_sox=C:\Program Files (x86)\sox-14-4-2\sox.exe"
for %%i in ("*.wav") do "%_sox%" -S "%%~fi" "Mono\%%~ni.wav" channels 1
我必须放置此.bat 代码>在我想要转换的文件夹中的文件。我的文件夹结构正在扩展,我必须手动浏览每个文件夹,放置
.bat
文件并运行脚本以获取所得的单声道文件。
这是我的文件夹结构的一个示例:
Main Folder
|
|______fold1
| |_____file1.wav
| |_____file2.wav
|
|______fold2
| |_____file1.wav
| |_____file2.wav
|
|______fold3
|_____file1.wav
|_____file2.wav
使用扩展的文件夹结构,我想将.bat
文件放在主文件夹中,运行脚本,脚本将通过每个子文件夹,创建每个子文件夹中的“单声道”文件夹,然后将转换后的单wav文件放入其中。这应该是带有转换的单声道文件的更新文件结构:
Main Folder
|
|______fold1
| |_____file1.wav
| |_____file2.wav
| |_____Mono
| |______file1.wav
| |______file2.wav
|______fold2
| |_____file1.wav
| |_____file2.wav
| |_____Mono
| |______file1.wav
| |______file2.wav
|______fold3
| |_____file1.wav
| |_____file2.wav
| |_____Mono
| |______file1.wav
| |______file2.wav
请让我知道如何修改.bat
文件以完成此任务。谢谢!
I have a batch script file that converts existing wav
files to Mono wav files to a created folder called "Mono"
CODE
@echo off && cd /d "%~dp0"
2>nul mkdir "Mono"
set "_sox=C:\Program Files (x86)\sox-14-4-2\sox.exe"
for %%i in ("*.wav") do "%_sox%" -S "%%~fi" "Mono\%%~ni.wav" channels 1
I have to place this .bat
file in the folder that I want converted. My folder structure is expanding and I have to go through each folder manually, place the .bat
file and run the script to get the resultant mono files.
Here is an example of my folder structure:
Main Folder
|
|______fold1
| |_____file1.wav
| |_____file2.wav
|
|______fold2
| |_____file1.wav
| |_____file2.wav
|
|______fold3
|_____file1.wav
|_____file2.wav
With the expanding folder structure, I wanted to place the .bat
file in the Main Folder, run the script, and the script will go through each subfolder, create the "Mono" folder in each subfolder and place the converted mono wav files in there. This should be the updated file structure with the converted mono files:
Main Folder
|
|______fold1
| |_____file1.wav
| |_____file2.wav
| |_____Mono
| |______file1.wav
| |______file2.wav
|______fold2
| |_____file1.wav
| |_____file2.wav
| |_____Mono
| |______file1.wav
| |______file2.wav
|______fold3
| |_____file1.wav
| |_____file2.wav
| |_____Mono
| |______file1.wav
| |______file2.wav
Please let me know how to modify the .bat
file to accomplish this task. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是我的方式:
dir /b < /code>列出了指定文件夹中的每个文件和文件夹。
对于它找到的每个文件夹,它将在其中创建一个单声道文件夹,然后为每个
.wav
找到的文件运行SOX命令。希望这会有所帮助。爱你的名字顺便说一句
This is how I would do it:
DIR /B
lists every file and folder within the specified folder.For each folder it finds, it will create a Mono folder within it, and then run the sox command for each
.wav
file found.Hope this helps. Love your name btw