Visual Studio 2003 and 2005 (and perhaps 2008 for all I know) require the command line user to run in the \'Visual Studio Command Prompt\'. When starting this command promp
Create your own batch file (say clenv.bat), and call that instead of cl:
@echo off
:: Load compilation environment
call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"
:: Invoke compiler with any options passed to this batch file
"C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\cl.exe" %*
clenv.bat can now be invoked just like cl.exe, except that it will first load the needed environment variables first.