I have installed the Microsoft Visual C++ Build Tools 2015 on my 64bit win10 , and can use the cl.exe to compile and link the C/C++ program in a plain Command Prompt window by the following steps (some instructions from Setting the Path and Environment Variables for Command-Line Builds):
1. cd "\Program Files (x86)\Microsoft Visual Studio 14.0\VC" 2. vcvarsall amd64 3. cl helloworld.c The helloworld.c is just a simple C source file to print "Hello world!". I aslo try to congfigure the task.json to directly compile and link C/C++ programs in the vs code. Here is my task.json:
{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "0.1.0", "command": "vcvarsall amd64 && cl", "isShellCommand": true, "args": ["${file}"], "showOutput": "always" } And the path of vsvarsall and cl have been added in the PATH. But it still doesn't work (the output is put at the end of the post). So my question is that: how can I to define the task.json which can first run the vcvarsall amd64 to set system variables and then execute the cl command to compile and link programs.

.batfile and point thecommandparameter to it? That would work, and you would not have to worry on how VSC handles the command since what you are doing now seems weird - you are concatenating twocmdoperations and also passing a file as a parameter to this. I'd advise a batch file and just set the path to it in thecommandvalue.