Configuring cl CMD compiling Windows

2019-09-14 09:01发布

问题:

I have already read on MSDN.com that to enable command line compilation through the cl command you have to run the vcvarsall.bat file. I have run this file in CMD and compiled code using the cl command. The issue is that after I leave the CMD and reopen it, I no longer have the ability to use cl and have to rerun vcvarsall.bat every time I reopen CMD. Is there any way to avoid having to do this? Thanks.

回答1:

Just create a shortcut on your desktop that calls

cmd /k "%VS140COMNTOOLS%\vsvars32.bat"

Adapt the environment variable and batch file name to fit your installed VS version number. In the example above, this will work with Visual Studio 2015.