This script is run from within a directory of OGG files.
cd c:\dirWithOGG
for %%f in (*.ogg) do (
sox %%f %%f pad 0 "soxi -D %%f"
sox %%f %%f repeat 10
)
First time I’ve had to create a batch script, I thought it’s going to easy.
soxi -D %%f
On it’s own, the above returns a decimal value. For some reason, it’s doesn’t execute from within the script. sox and soxi are in a location added to PATH.
Any help appreciated, thanks.
If you want to use the output of
soxi -D %%fas a command line parameter forsox, here’s how you can do that:As you can see, the commands inside the loop have been moved to a subroutine that the loop is calling now. Other than that, the output of
soxiis redirected to a file, which then is read into a variable, which in turn is used to pass the value tosox.It’s actually because of the variable that I had to move the commands outside the loop. It would work incorrectly inside the loop unless delayed expansion was enabled and a different syntax was used to address the variable. I preferred it implemented as above, though.