How can I stop LAME adding .wav to output file? Encode by right-click?
Reply #4 – 2013-01-02 20:12:18
The easiest solution to avoid ".wav.mp3" extensions is to use LAME 3.99 or newer. Regardless, if you are already in the folder of .wav files, you can do this at the command prompt:FOR %F IN (*.wav) DO lame.exe -V0 "%F" "%~nF.mp3" If you just do for /? then you can read all about what the "FOR" command does and how to use it.%F is a variable that I chose to name F. It represents one .wav file name at a time. %~nF represents that name without the .wav extension. Double quotes are there in case the file name contains spaces, so LAME doesn't think the spaces distinguish arguments. So the command line says, "in the current folder, for each file name ending with .wav, assign that name to the variable F, then execute lame.exe with three arguments: -V0 ; the value of F in double quotes; and, also in double quotes, the value of F-without-.wav followed by .mp3 " Were you planning to run this on a folder with hundreds of WAVs in it? I'm not sure, but I think *.wav gets expanded to the same thing as if you typed every .wav file name out by hand, separating them with spaces, and double-quoting any that contain spaces. If this expanded form would exceed 8191 characters, then the command line will be too long and will fail to run. Don't quote me on that, though. I had some free time today, so I figured out how to add a context menu item for folders. In Regedit, navigate to HKEY_CLASSES_ROOT\Folder\shell. Create a new key (looks like a folder) called "MP3-encode this folder's WAVs" or whatever you want to see in the context menu. Inside that key, create a new key called command. Double-click on its "(Default)" value and paste in this string:cmd.exe /C "cd "%L" && FOR %%F IN (*.wav) DO "E:\apps\lame-3.98.4\lame.exe" -V0 "%%F" "%%~nF.mp3"" You will have to modify the path to lame.exe, of course. It should take effect immediately. If the window just opens and closes, there was an error, or no .wav files to process. %L, %V, etc. are special variables that only apply to this situation (launching something specified in a 'command' registry key). They're apparently undocumented, but in the Community Additions section of Microsoft's Extending Shortcut Menus how-to, there's a comment by a Microsoft employee that explains what they are. %L is the long file name of the argument, which in this case will be the folder you right-clicked on. As explained by cmd /? , the /C tells cmd.exe to treat what comes next as a command to run (as if typed at the prompt) and then exit. You can use /K instead if you want the window to remain open. The outer double quotes are stripped; the inner ones are preserved. Just like in batch scripts, variable references must be escaped with an extra "%", so that they're not interpreted by whatever is interpreting the %L. The current working directory will be the parent folder of the one you clicked on, hence the need to first "cd" to the chosen directory (%L), which is double-quoted in case it contains spaces. "&&" can be thought of as "...and then, if that worked, here's another command to try..." Insert obligatory "don't mess around too much in Regedit, because you can really screw up Windows" caution here.