Next post: Speed Reader

Drag Drop Batch

I recently learned how to create a batch file that can accept process any number of files passed to it through drag and drop. If I use %1, %2, %3, and so on, it can only work up to %9.

Here's a useful example: when encoding MP3s, I've found it's often faster to skip the user interface and use LAME directly. Download the LAME mp3 encoder someplace, and it will come with an executable. Then, you can write a batch file (.bat) like:
rem Adapted from a script by Robert Hegemann
@echo off
if %1=="" goto endmark

"C:\path\to\lame.exe" -h --abr 160 --mp3input %1
if errorlevel 1 goto errormark
goto processArgs
echo ERROR processing %1
Put the batch file someplace accessible. To encode some songs, all you need to do is drag and drop them onto the batch file.