vcvarsamd64.bat problems

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Looking at vcvarsamd64.bat Ive put so elementary echo statements (write statements) in it to see why WindowsSdkDir isnt set in it.
It appears that function GetWindowsSdkDirHelper isnt doing the "reg query" correctly. Actually I dont think GetWindowsSdkDirHelper is being exercised. Obviously I dont understand all this.
Dont see a way to upload or attach a file so Ill append my vcvarsamd64.bat below. Youll note that Ive changed the registry path HKLM to what it should be for Windows 7 64-bit. Also if I exercise only the section of the coding that does the
req query, I get two printouts (as I should) saying
"reg query "HKLMSOFTWAREWow6432NodeMicrosoftMicrosoft SDKsWindows" /v "CurrentInstallFolder" is not recognized as an internal or external command,"
Thanks for any help you can provide.

____________ My vcvarsamd64.bat with extra echo statements _______________________________
@SET VSINSTALLDIR=D:Program Files (x86)Microsoft Visual Studio 9.0<br/>
@SET VCINSTALLDIR=D:Program Files (x86)Microsoft Visual Studio 9.0VC<br/>
@SET FrameworkDir=C:WindowsMicrosoft.NETFramework64<br/>
@SET FrameworkVersion=v2.0.50727<br/>
@SET Framework35Version=v3.5<br/>
@if "%VSINSTALLDIR%"=="" goto error_no_VSINSTALLDIR<br/>
@if "%VCINSTALLDIR%"=="" goto error_no_VCINSTALLDIR<br/>
<br/>
@echo Setting environment for using Microsoft Visual Studio 2008 Beta2 x64 tools.<br/>
<br/>
@call :GetWindowsSdkDir<br/>
@echo Exiting GetWindowsSdkDir %WindowsSdkDir%<br/>
<br/>
@if "%WindowsSdkDir%" == "" goto SetPaths<br/>
<br/>
@set PATH=%WindowsSdkDir%binx64;%WindowsSdkDir%binwin64x64;%WindowsSdkDir%bin;%PATH%<br/>
@set INCLUDE=%WindowsSdkDir%include;%INCLUDE%<br/>
@set LIB=%WindowsSdkDir%libx64;%LIB%<br/>
<br/>
:SetPaths<br/>
@echo Entering SetPaths<br/>
@set PATH=%VCINSTALLDIR%BINamd64;%FrameworkDir%%Framework35Version%;%FrameworkDir%%Framework35Version%Microsoft .NET Framework 3.5 (Pre-Release Version);%FrameworkDir%%FrameworkVersion%;%VCINSTALLDIR%VCPackages;%VSINSTALLDIR%Common7IDE;%VSINSTALLDIR%Common7Tools;%VSINSTALLDIR%Common7Toolsbin;%PATH%<br/>
@set INCLUDE=%VCINSTALLDIR%ATLMFCINCLUDE;%VCINSTALLDIR%INCLUDE;%INCLUDE%<br/>
@set LIB=%VCINSTALLDIR%ATLMFCLIBamd64;%VCINSTALLDIR%LIBamd64;%LIB%<br/>
@set LIBPATH=%FrameworkDir%%Framework35Version%;%FrameworkDir%%FrameworkVersion%;%FrameworkDir%%Framework35Version%;%FrameworkDir%%FrameworkVersion%;%VCINSTALLDIR%ATLMFCLIBamd64;%VCINSTALLDIR%LIBamd64;%LIBPATH%<br/>
@echo Exiting SetPaths<br/>
@goto endprep<br/>
<br/>
<br/>
:GetWindowsSdkDir<br/>
@echo Entering GetWindowsSdkDir<br/>
@call :GetWindowsSdkDirHelper HKLM > nul 2>&1<br/>
@if errorlevel 1 call :GetWindowsSdkDirHelper HKCU > nul 2>&1<br/>
@if errorlevel 1 echo WindowsSdkDir not found<br/>
@exit /B 0<br/>
<br/>
<br/>
:GetWindowsSdkDirHelper<br/>
@echo Entering GetWindowsSdkDirHelper<br/>
@SET WindowsSdkDir=<br/>
@for /F "tokens=1,2*" %%i in (reg query "%1SOFTWAREWow6432NodeMicrosoftMicrosoft SDKsWindows" /v "CurrentInstallFolder") DO (<br/>
if "%%i"=="CurrentInstallFolder" (<br/>
SET "WindowsSdkDir=%%k"<br/>
)<br/>
)<br/>
@echo Exiting GetWindowsSdkDirHelper<br/>
@if "%WindowsSdkDir%"=="" exit /B 1<br/>
@exit /B 0<br/>
<br/>
<br/>
:error_no_VSINSTALLDIR<br/>
@echo ERROR: VSINSTALLDIR variable is not set. <br/>
@goto endprep<br/>
<br/>
<br/>
:error_no_VCINSTALLDIR<br/>
@echo ERROR: VCINSTALLDIR variable is not set. <br/>
@goto endprep<br/>
<br/>
<br/>
:endprep<br/>
@echo Entering endprep<br/>
<br/>
<br/>
:end
<br/>

View the full article
 
Back
Top