2

I've worked out how to convert wavs to mp3s via VLC using the command line tool in WinXP.

'vlc "C:\temp\Britney Spears - California Uber Alles.wav" :no-video :sout=#transcode{acodec=mp3,ab=256}:std{access=file,mux=dummy,dst="c:\temp\Britney Spears - California Uber Alles.mp3"} vlc://quit'

Is there a way that I can substitute the filename, like %1, so that the output name is named the same as the input name (with the exception of the extension, obviously). Thank you.

2

yeah, I may not have the double quotes perfect for every case, but you can customize it as you want it. And note that %~1 would remove quotes whereas %1 would keep quotes. And you can add quotes within the batch file too, perhaps around a %~1 or wherever you want.

you can remove the echo lines too, they're just to demonstrate to you the concept of %~dnp1

The key is %~dpn1 rather than %1

Here is an example of a bat file called a.bat and you would call

C:\>a.bat "C:\temp\Britney Spears - California Uber Alles.wav"

Notice there are two invocations of vlc, one shows your one, the other shows with %1 or %~dpn1

I included both just to demonstrate it so you see the two.

do call /? to see variations of %1 e.g. how I found out about %~dpn1

echo %1
echo %~dnp1
echo a.bat blah.wav

vlc "C:\temp\Britney Spears - California Uber Alles.wav" :no-video :sout=#transcode{acodec=mp3,ab=256}:std{access=file,mux=dummy,dst="c:\temp\Britney Spears - California Uber Alles.mp3"} vlc://quit


vlc %1 :no-video :sout=#transcode{acodec=mp3,ab=256}:std{access=file,mux=dummy,dst="%~dnp1.mp3"} vlc://quit
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.