try running path\to\VC\bin\vcvars32.bat from within your current shell first. This should ensure your command-line setup will match the IDE-setup.

This is not a permanent fix -- you need to do it every time you launch a new shell.

You could probably also find some way to add everything that's in that .bat permanently to the environment variables, but.... like you asked, why the heck doesn't the MS install do that already?


Add Microsoft Visual Studio 10.0\Common7\IDE to your path, and this issue will not exist any more. You will be able to build without running this silly batch file every time.


I noticed when I installed Microsoft Visual Studio 2010 Express that under the "Microsoft Visual Studio 2010 Express" folder in the Start Menu, there is a link to "Visual Studio Command Prompt (2010)", which sets up all the necessary environment variables when opened. That way you shouldn't have to edit you PATH variable.

This shortcut runs the following:

%comspec% /k ""C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"" x86

If it's not convenient to use the shortcut, perhaps you could learn something of use from investigating what this .bat file does?


I met same error,it is because we installed a vs2010 x86 version to a x64 system...

Open two folders:

C:\Windows\Microsoft.NET\Framework\v4.0.30319

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin

You will find two cvtres.exe. Righ click, select Properties, then Details. Delete the older version, and cmake will work well. I hope this may help you.

Thanks to "zhoudongao" @ http://bbs.csdn.net/topics/390121452?page=1#post-394768226.


I know this is a bit dated but if anyone's looking for a way to get compiler running from command line; here's what I did to get it running.

I'm using Win7 32bit and Visual Studio 2010. I created a small batch file in C:\Windows. open cmd prompt at C:\Windows as admin, then type the following:

copy con cl.bat

@"C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32" %1 %2 %3 %4 %5 %6
@"C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\cl" %1 %2 %3 %4 %5 %6

then press f6 and hit enter again.

Obviously the path you will use is the install path to where you installed Visual Studio.

You now have working command line compiler from any location or directory in windows. To test this go to desktop and open cmd prompt as admin; I prefer to use Ctrl+Shift and right click then choose open command prompt here. At command prompt type "cl" (without quotes) and hit enter. you will see a message "Setting enviroment for using Microsoft Visual Studio 2010 x86 tools"

type "cl" and hit enter again and you will get your compiler info. you're all set to compile.

enjoy!