[英]batch process files in subfolder instead of current folder
I seem to have a problem using either %cd%
or %~dp0
in a file path in a batch file, which I think is because the file path has a space in it. 我在批处理文件的文件路径中使用
%cd%
或%~dp0
似乎有问题,我认为这是因为文件路径中有空格。
The files are in the path C:\\Users\\maxmik\\Desktop\\WEM CONVERTER
. 这些文件位于路径
C:\\Users\\maxmik\\Desktop\\WEM CONVERTER
。 I am using ww2ogg and revorb to convert wem files into ogg, but want to be able to use a subfolder I named wemfiles
to hold the wem files and converted ogg files, instead of having them all in the same folder as the batch file and executables. 我正在使用ww2ogg和revorb将Wem文件转换为ogg,但是希望能够使用一个名为
wemfiles
的子文件夹来保存wem文件和转换后的ogg文件,而不是将它们全部与批处理文件和可执行文件放在同一文件夹中。
Here's the batch file script: 这是批处理文件脚本:
@echo off
for %%f in (%~dp0/wemfiles/*.wem) do ww2ogg.exe %%f --pcb packed_codebooks_aoTuV_603.bin
for %%f in (%~dp0/wemfiles/*.ogg) do revorb.exe %%f
echo Job Complete!
pause
pause
here's the output from it: 这是它的输出:
Audiokinetic Wwise RIFF/RIFX Vorbis to Ogg Vorbis converter 0.24 by hcs
Input: C:\Users\mmaksim\Desktop\WEM
Error opening C:\Users\mmaksim\Desktop\WEM
Could not open input file.
Job Complete
Press any key to continue . . .
If I use the following batch file instead with the wem files in the same folder as the executables, it works just fine. 如果我将以下批处理文件与wem文件一起使用,并且与可执行文件放在同一文件夹中,则可以正常工作。
@echo off
for %%f in (*.wem) do ww2ogg.exe %%f --pcb packed_codebooks_aoTuV_603.bin
for %%f in (*.ogg) do revorb.exe %%f
echo Job Complete!
pause
pause
Doublequotes are your friend: 双引号是您的朋友:
@Echo Off
For %%A In ("%~dp0wemfiles\*.wem") Do ww2ogg.exe --pcb packed_codebooks_aoTuV_603.bin "%%A"
For %%A In ("%~dp0wemfiles\*.ogg") Do revorb.exe "%%A"
Echo Job Complete!
Pause
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.