Here is a Windows command shell script I wrote to convert MP3 files to AAC for my Softbank 821SC phone. The script uses FFmpeg, which I downloaded from here.
@echo off
REM ---------------------------------------------------------------------------
REM Set the following variable to the ffmpeg.exe path on your system.
REM ---------------------------------------------------------------------------
set FFMPEG_PATH="c:\tools\FFmpeg\ffmpeg.exe"
REM make sure the user provided an argument.
if NOT "%~1" == "" goto ARGS_OK
REM bad arguments, print error and exit.
echo.
echo Usage examples:
echo mp3toaac.bat file_to_convert.mp3
echo mp3toaac.bat *.mp3
echo mp3toaac.bat some_directory\*.mp3
exit /b 1
:ARGS_OK
REM use for/in so that we can accept individual files or wildcards.
for %%i in ("%~1") do %FFMPEG_PATH% -i "%%~i" "%%~ni.aac"
echo.
echo Done.
exit /b 0
Interesting elements of this batch file:
-
Use of for/in in order to accept both filenames and wildcards.
Use of %~X to strip parentheses from a filename variable.
Use of %~nX to strip the extension from a filename variable (i.e. retrieve the basename).