Page 1 of 1

Batch file for mp3 encoding

Posted: 10 May 2008 10:44
by Ant_222
Hi, I'd like to create an MSDOS *.bat file that'd take all the *.wav files in the current directory and for each of them call

Code: Select all

lame.exe [options] filename.wav filename.mp3

In other words, my problem is that I can't figure out how rename *.wav to *.mp3 inside a FOR loop because the SET command seems to be ingnored...

Posted: 12 May 2008 15:56
by jeb
Hi,

Code: Select all

for %%a in (*.wav) DO lame.exe /myoptions %%a %%~na.mp3


should work.

The trick is %%~n which results in the filename (without) extension.

jeb

Posted: 13 May 2008 06:53
by Ant_222
Many thanks!

It turns out that lame automatically renames filename.wav into filename.mp3 if the output file is not specified.
But just for the sacred MSDOS knowledge, thnx. And why the SET command called inside a FOR loop doesn't seem to work? Should I provide an example?

Anton