Windows SDK のインストール ディレクトリ の取得 - バッチファイル
バッチファイルで、Windows SDK のインストール ディレクトリ を取得する方法です。
---
call :GetCurrentWindowsSdkDir
echo CurrentWindowsSdkDir: %CurrentWindowsSdkDir%
call :GetWindowsSdk71Dir
echo WindowsSdk71Dir: %WindowsSdk71Dir%
goto :EOF
rem ===================================================
rem GetCurrentWindowsSdkDir
rem ===================================================
:GetCurrentWindowsSdkDir
for /f "tokens=1,2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows" /v "CurrentInstallFolder"') do (
if /i "%%i"=="CurrentInstallFolder" (
set "CurrentWindowsSdkDir=%%k"
)
)
if "%CurrentWindowsSdkDir%"=="" (
exit /b 1
)
exit /b 0
rem ===================================================
rem GetWindowsSdk71Dir
rem ===================================================
:GetWindowsSdk71Dir
for /f "tokens=1,2*" %%i in ('reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1" /v "InstallationFolder"') do (
if /i "%%i"=="InstallationFolder" (
set "WindowsSdk71Dir=%%k"
)
)
if "%WindowsSdk71Dir%"=="" (
exit /b 1
)
exit /b 0
---
投稿日時 : 2011年10月12日 16:35
Tweet

コメントを追加