I installed Visual Studio 2017 and toolsets v140 and v141. To work with v140 toolset, I need to set the necessary environment via vc
There is an additional command-line argument for the newer vcvars*.bat files: vcvars_ver.
To setup an enviroment using the VS2015 toolchain with VS2017 one has to append -vcvars_ver=14.0 to the new vcvars*.bat call.
E.g. "c:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" x64 8.1 -vcvars_ver=14.0 sets up an environment for x64 using Windows 8.1 SDK and the MSVC2015 toolchain.
There is no need to change any value in the registry or modify the installed batch files.
Source: https://developercommunity.visualstudio.com/solutions/140023/view.html