简体   繁体   English

在子文件夹而不是当前文件夹中批处理文件

[英]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.

相关问题 从当前文件夹中的所有文件以及子文件夹Windows批处理中的文件中删除前缀 - Remove Prefix from all file in current folder as well as files in subfolder windows batch 批量创建文件夹和子文件夹 - Create folder and subfolder in batch 批处理文件以计算文件夹中的所有文件和子文件夹文件,并使用批处理文件以文件夹名称写入输出文件 - batch file to count all files in a folder and subfolder files and write output file in folder name using batch file 如何使用此批处理文件将所有* .txt文件从子文件夹复制到批处理文件文件夹? - How to copy all *.txt files from subfolder to batch file folder using this batch-file? 如何使用批处理文件向当前文件夹和子文件夹中的所有文件添加前缀 - How to Add prefix to all file in current folder and subfolder using batch file 如何在批处理 (.bat) 文件中创建名称为当前日期的文件夹 - How to create a folder with name as current date in batch (.bat) files 如何通过在批处理脚本中创建当前日期来复制文件并粘贴到文件夹中 - How to copy files and paste in folder by creating a current date in batch script 循环到子文件夹批处理文件重复相同的文件夹 - Looping to subfolder batch file repeats same folder 从当前文件夹运行批处理文件 - Batch file runfrom current folder 批处理文件,仅将每个子文件夹的文件类型之一复制到另一个文件夹 - batch file to copy only one of filetype for each subfolder to another folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM