Windows VB Script for Batch WMA to MP3 Conversion

A few months back, I was attempting to load my music collection on my iPhone for the first time and was encountering issues.  My situation:

  1. I was running iTunes in a Virtual Machine to avoid all the crapware that iTunes installs.
  2. My music library was a combination (about half and half) of WMA and MP3 files.
  3. My music library was well organized in a folder hierarchy.
  4. The iTunes converter was giving me grief upon importing my music library.  (I seem to recall that due to the use of virtual machine snapshots, iTunes kept getting confused and re-converting certain WMA files that had already been converted by it; furthermore, due to the virtualization, conversion of my music library was taking forever!)

“No problem,” I thought, “I’ll just find a tool to batch-convert my entire music library to MP3 format, which is compatible with iTunes.”  My plan was to run this once on the host and then import the entire (converted) folder into iTunes on the VM.

My requirements were as follows:

  1. Tool shall recursively process the music library folder.
  2. Tool must allow specification of an output folder that is different from the source folder.
  3. Upon executing conversion, tool shall replicate the source folder hierarchy, recreating that folder hierarchy within the destination folder.
    1. Upon encountering a WMA file, tool shall auto-convert the file and place the resulting MP3 file in the same relative location in the destination folder hierarchy. (My various audio files frequently had the same filenames but were in different folders in the folder hierarchy, so putting everything in one single-level folder wouldn’t work.)
    2. Upon encountering a non-WMA file, tool shall support automatic duplication of the source file to the same relative location in the destination folder hierarchy. (This way, my MP3 files would simply be duplicated and not converted.)

After understanding what I wanted to do, I spent quite a while searching the Internet for a conversion tool that supported my (rather simplistic) requirements.  I downloaded, installed, and tested (in a VM) quite a few tools, and none of them supported what I wanted.  In many cases, the tools failed to support folder recursion, and for those tools that did, the tool either converted the files in place or dumped all of the files (from all the subfolders) into a single output folder without replicating the folder hierarchy.

At this point, I was pretty annoyed with the various converters available; whether “free” or “paid,” most were very poorly designed, unstable, and generally “overkill” for my problem.  After over an hour of experimenting, I stumbled upon a blog post that discussed the use of vbscript + FFmpeg to do the conversion.

Using FFmpeg to do the conversion had occurred to me, but I lacked an easy way to run FFmpeg recursively and duplicate the source folder hierarchy. At this point; however, I was ready to script those aspects of the conversion myself.  I liked the approach taken by the Phurix Labs script (in the above blog post) to make use of the “Send To” menu to allow for easy activation of the script.  So, I retained that aspect but wrote the recursive code mostly from scratch…

A few hours later, and I had my script finished.  Yes, vbscript is painful, but it has the advantage of working natively on practically any Windows system.


Version: 0.85
Script Download Link


  1. Recursive traversal of the selected folders.  Selection of more than one source folder/file is allowed.
  2. Supports two output options:
    1. In-place conversion.  Places resulting MP3 files in the same location as the original WMA files.
    2. Selection of alternate output directory.  Source folder tree is replicated to destination folder and resulting MP3 files are placed in the same relative location.  User is also given the option to duplicate or ignore non-WMA files.
  3. Script complains if a particular FFmpeg conversion process appears to be taking too long.

Installation Instructions

  1. Download FFmpeg.
    1. Visit the FFmpeg site, scroll down to “Windows Binaries” and follow the instructions from there.
    2. Use 7-zip to extract the FFmpeg binaries to a folder such as C:\Program Files (x86)\FFmpeg\
  2. Add the directory containing FFmpeg to the system path.  Google it if you don’t know how to do this.
  3. Download & install the script.
    1. Download the .vbs script file.
    2. Open the “send to” folder in Windows by either typing “shell:sendto” into an Explorer window’s address bar or using Start -> Run.
    3. Copy the .vbs script file into the “send to” folder.

Run the script by right-clicking on the source folder(s) and/or source files(s) and clicking Send To –> Convert WMA to MP3.


  1. Ryan says:

    I really appreciate this script! Google Music doesn’t accept wma files, and I need my tunes somewhere safe! 🙂

    Keep walking with Jesus. 🙂

  2. gregg says:

    give this a try. a culmination of script searching over the years…
    change your file types in according spaces then it’s drag and drop.

    @echo off
    ::parse multiple command lines (so multiple targets can be dragged and dropped at once)
    if “%~1″==”” goto :continue
    call :mainloop %1
    goto :commandlineloop
    goto :eof

    ::main loop we run for each command line arg of the script
    set folderpath=
    if “%~1″==”” (
    echo Drag and drop files or folders onto this script.
    goto :eof
    set folderpath=%~1
    echo “%1” | find /I “.mov” && (
    goto :fileonly
    echo “%1” | find /I “.m4v” && (
    goto :fileonly
    echo “%1” | find /I “.mp4” && (
    goto :fileonly
    echo “%1” | find /I “.wmv” && (
    goto :fileonly
    echo “%1” | find /I “.flv” && (
    goto :fileonly
    echo “%1” | find /I “.avi” && (
    goto :fileonly
    echo “%1” | find /I “.mpeg” && (
    goto :fileonly

    echo Processing folder %1
    echo ________________________________________________________________________________

    ::we need to find the last folder level in the folderpath
    set temp_string=%~1
    set count=0

    for /F “tokens=1* delims=\” %%a in ( “%temp_string%” ) do (
    set /A count+=1
    set temp_string=%%b
    goto loopcounter
    for /F “tokens=%count% delims=\” %%i in ( “%~1” ) do set folder=%%i
    for /R “%folderpath%” %%i in (*.mov *.m4v *.mp4 *.wmv *.flv *.avi *.mpeg) do (
    set sourcepath=%%~di%%~pi
    set destpath=!sourcepath:%folder%=mkv\%date%\!
    md “!destpath!”
    ffmpeg -y -i “%%~fi” -metadata title=”” -metadata comment=”” -s hd480 -aspect 16:9 -vcodec hevc -acodec aac -preset ultrafast -threads 0 “!destpath!%%~ni.mkv”
    del “%sourcepath%”
    goto :eof

    ::individual files
    for %%i in (“%folderpath%”) do (
    ffmpeg -y -i “%folderpath%” -metadata title=”” -metadata comment=”” -s hd480 -aspect 16:9 -vcodec hevc -acodec aac -preset ultrafast -threads 0 “!destpath!%%~ni.mkv”

    save as .cmd

  3. David Kouts says:

    Thank you, this was *exactly* what I needed!!!

  4. David Kouts says:

    I was having the exact same frustrations you describe above, when I came across your page. Thank you so, so, so much!

  5. Lucy Bastin says:

    Have just stumbled on this and adapted it for a vast (carefully-structured) directory of digitised cassettes. Thank you, much appreciated!!! All the best.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.