You have to set the path and environment variables for command line builds first. See Build C/C++ Code on the Command Line | Microsoft Docs
If you have created a VS project you can build it with the msbuild
command line utility. See MSBuild Command-Line Reference - Visual Studio | Microsoft Docs
SET VS=C:\Program Files (x86)\Microsoft Visual Studio 14.0
cl.exe /EHsc "%PROJ%\program.cpp"
IF NOT %ERRORLEVEL%==0 GOTO Done