It depends on what compiler you're using.
For example, if you are using Visual C++ .NET 2010 Express, run Visual C++ 2010 Express Command Prompt from the start menu, and you can simply compile and run the code.
> cl /EHsc mycode.cpp
> mycode.exe
or from the regular command line, you can run vcvars32.bat
first to set up the environment. Alternatively search for setvcvars.cmd
(part of a FLOSS project) and use that to even locate the installed VS and have it call vcvars32.bat
for you.
Please check your compiler's manual for command lines.