Try starting the Visual Studio Command Prompt from
Start->
All Programs ->
Microsoft Visual Studio 2010 ->
Visual Studio Tools ->
Visual Studio Command Prompt 2010
Alternatively, you can set up the environment by running this in a command prompt:
"c:Program Files (x86)Microsoft Visual Studio 10.0VCvcvarsall.bat" x86
(note: this will leave your environment set up after running.)
(note2: change x86
as desired. options are x86
, ia64
, amd64
, x86_amd64
, x86_ia64
)
From there you can run cl.exe
. If you want this to be automatically done and undone whenever you run cl
, create a batch file with this content:
@echo off
%comspec% /c ""c:Program Files (x86)Microsoft Visual Studio 10.0VCvcvarsall.bat" x86 && cl.exe %*"
(the /c
tells the command prompt to end the session after running this command, so your environment returns to normal.)
From there, name it cl.bat
. Put this in a folder somewhere, and add the path to that folder to your PATH
environment variable, making sure it comes before the path to cl.exe
, so that this cl.bat
is executed whenever you type cl
instead of cl.exe
I recommend you just put cl.bat
in your system32/
folder, it should come before cl.exe
's path on a default installation.
Alternatively, you can add it in any order and always type cl.bat
, or name it something else so there's no confusion.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…