Machine: Windows XP SP3
Issue: Need to convert several WAV files to MP3
Gripes: Don't want to do it one-at-a-time, or use a GUI; must be "scriptable."
Tool of choice: Lame, for /f
Command:
for /f "usebackq delims=" %g in (`dir /b d:\drop\aud\*.wav`) do @%programfiles%\lame\lame.exe -b 192 -h "d:\drop\aud\%g" "d:\dl\aud\%g.mp3"
Notes:
- Use this raw when copying directly to prompt. If putting in a .bat or .cmd file, remember to change all instances of %g to %%g.
- Also, the quotes immediately inside the parentheses are backquotes, usually on the same key as your tilde (~) character in the upper left-hand corner of your keyboard.
Other Gripes:
- This is obviously very rudimentary, as it doesn't strip the .wav off the end first; it just creates a .wav.mp3 file which you would then have to rename.
- If you want to script that out, you could do so as follows:
set originalFile=%%g:.wav=%
That searches the %g iterative variable for the .wav and strips it off, assigning the result tooriginalFile
.
My blog doesn't currently get much traffic, but if there's any interest later, I'll add a full script to do this.