VS2010 command prompt gives error: Cannot determine the location of the VS Common Tools folder

I have installed VS2010. The installation creates the shortcut for VS2010 command prompt but when I open up the command prompt I get the error:

Cannot determine the location of the VS Common Tools folder.

I checked the environment variable VS100COMNTOOLS and it has value: C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\ and the registry for HKEY_local_Machine\Software\Microsoft\Visual Studio\SxS\VS7 is set to: C:\Program Files\Microsoft Visual Studio 10.0\.

I checked the VSvars32.bat and tried to add echo to find till where it proceeds. It fails at this command:

@call :GetVSCommonToolsDirHelper32 HKLM > nul 2>&1

I had the same issue and found the answer here.

The problem is that the bat uses de reg command and it searches that in the PATH system variable. Somehow you have managed to get "C:\Windows\System32" out of the PATH variable, so just go to the system variables (right click "My Computer" > "Properties" > advanced config > "Environment Variables", search the PATH variable and add at the end separated by ";" : C:\Windows\System32


I had the same problems in two machines: Win8.1x64 with Visual Studio Ultimate 2013 (VS2013) and Win8x64 with VS2013 ultimate

Problem: Shortcut "VS2012 x86 Native Tools Command Prompt" which points to file: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat which calls C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\vcvars32.bat tries to search the registry for value name "11.0":

reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "11.0"

However my machine doesn't have this value "11.0", instead it has "12.0"

My solution is to run C:\Program Files (x86)\ Microsoft Visual Studio 12.0 \VC\vcvarsall.bat which calls C:\Program Files (x86)\ Microsoft Visual Studio 12.0 \VC\bin\vcvars32.bat which correctly query the registry as the following:

reg query "%1\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "12.0"

So changing/running from C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat to C:\Program Files (x86)\ Microsoft Visual Studio 12.0 \VC\vcvarsall.bat solved it in my case


This same problem just started occurring for me and I was able to "fix" it by updating the vcvars32.bat file located in the C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\ folder (by default). Add the following after the first line:

@SET VSINSTALLDIR=c:\Program Files\Microsoft Visual Studio 10.0\
@SET VCINSTALLDIR=c:\Program Files\Microsoft Visual Studio 10.0\VC\
@SET FrameworkDir32=c:\Windows\Microsoft.NET\Framework\
@SET FrameworkVersion32=v4.0.30319
@SET Framework35Version=v3.5

And then comment out the following lines:

:: @call :GetVSCommonToolsDir
:: @if "%VS100COMNTOOLS%"=="" goto error_no_VS100COMNTOOLSDIR
:: @call "%VS100COMNTOOLS%VCVarsQueryRegistry.bat" 32bit No64bit

Found this here. Note that I say fix in quotes because I haven't checked to make sure that all the appropriate variables are set properly; that said, at a cursory glance it does appear to be valid.

Note that you'll have to edit the vcvars32.bat file in an elevated text editor (ie, Run as Admin) to be able to save the file in Vista and Windows 7.


The issue in my case was a typo in the PATH variable. Since vsvars32.bat uses the "reg" tool to query the registry, it was failing because the tool was not found (just typing reg on a command prompt was failing for me).


That's a great post. Before making all the changes to vcvarsall.bat file, try running vs2010 command prompt as an administrator. If that still doesn't address the issue, try adding C:\Windows\System32 to the PATH environment variable. If all else fails, edit the batch file as described above.