VS2010 command prompt gives error : Cannot determine the location of the VS Common Tools folder
标签:
itvs2012注册表环境变量安装目录 |
分类: 电脑 |
装好Visual Studio 2012,打开它的命令行,有时会遇到如下错误
Cannot determine the location of the VS Common Tools
folderhttp://s12/bmiddle/001MKziZgy6WpUqLNdF7b&690command prompt gives error : Cannot determine the location of the VS Common Tools folder" TITLE="VS2010 command prompt gives error : Cannot determine the location of the VS Common Tools folder" />
你google,你bing,你得到的答案基本上都是说你没有把C:\Windows\System32
加入到Path环境变量里,因为它用到了reg命令。
打开文件 C:\Program Files (x86)\Microsoft Visual
Studio 11.0\VC\bin\vcvars32.bat
第86行,
@for /F "tokens=1,2*" %%i in ('reg query
"%1\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "11.0"') DO
(
@if "%%i"=="11.0" (
@SET "VS110COMNTOOLS=%%k"
)
)
我们发现它是自行搜索注册表,找到VisualStudio的安装目录,然后设置VS110COMNTOOLS环境变量。 但是如果注册表被禁止了呢?
即使reg命令可以找到,但无法打开注册表,那么
VS110COMNTOOLS就会被设置为空,继而引发错误
Cannot determine the location of the VS Common Tools
folder
可做如下实验:
1. 打开 gpedit.msc, User Configuration,
Administrativee Templateds, System, 找到Prevent access to registry
editing tools,
http://s15/bmiddle/001MKziZgy6WpVkepGKae&690command prompt gives error : Cannot determine the location of the VS Common Tools folder" TITLE="VS2010 command prompt gives error : Cannot determine the location of the VS Common Tools folder" />
双击,选成 Enabled
双击,选成 Enabled
http://s1/bmiddle/001MKziZgy6WpVpuPdKe0&690command prompt gives error : Cannot determine the location of the VS Common Tools folder" TITLE="VS2010 command prompt gives error : Cannot determine the location of the VS Common Tools folder" />
这时你就可以重现Cannot
determine the location of the VS Common Tools
folder错误了。
总结:
Cannot determine the
location of the VS Common Tools folder的原因:
1) C:\Windows\System32
没有被加入Path变量里
2)
注册表被禁了
如何解禁注册表
1)gpedit.msc, User
Configuration, Administrativee Templateds, System, 找到Prevent access
to registry editing tools, Disabled
2)
如果1)不通的话,Symantec提供了一个小工具
https://www.symantec.com/security_response/writeup.jsp?docid=2004-050614-0532-99
以上方法适用于visual studio其他版本。

加载中…