<p>How do you turn a Visual Studio build that you'd perform in the IDE into a script that you can run from the command line?</p>

Look into  build tool
NAnt
or
MSBuild
. I believe MSBuild is the build tool for Visual Studio 2005 and later. I am, however, a fan of NAnt...