Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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