(view source code of listsdks.bat as plain text)
@ECHO OFF
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
IF NOT "%~2"=="" GOTO Syntax
ECHO "%~1" | FIND.EXE "?" >NUL && GOTO Syntax
ECHO "%~1" | FIND.EXE "/" >NUL && GOTO Syntax
(REG.EXE Query /? 2>NUL) | FIND.EXE /I "/v Value" >NUL || GOTO Syntax
SETLOCAL ENABLEDELAYEDEXPANSION
SET ReqKeyword=%1
IF "%ReqKeyword%"=="" (SET RC=0) ELSE (SET RC=1)
FOR /F "tokens=6 delims=\" %%A IN ('REG.EXE Query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs') DO (
SET SDK.KeyWord=
SET SDK.Title=
SET SDK.Version=
FOR /F "tokens=3" %%B IN ('REG.EXE Query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\%%A /V KeyWord 2^>NUL ^| FIND.EXE "REG_SZ"') DO SET SDK.KeyWord=%%B
IF /I "%ReqKeyword%"=="" (
FOR /F "tokens=2*" %%B IN ('REG.EXE Query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\%%A /V Title 2^>NUL ^| FIND.EXE "REG_SZ"') DO SET SDK.Title=%%C
FOR /F "tokens=3" %%B IN ('REG.EXE Query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\%%A /V Version 2^>NUL ^| FIND.EXE "REG_SZ"') DO SET SDK.Version=%%B
IF NOT "!SDK.Version!"=="" ECHO !SDK.KeyWord! !SDK.Version! !SDK.Title!
) ELSE (
IF /I "%ReqKeyword%"=="!SDK.KeyWord!" (
FOR /F "tokens=2*" %%B IN ('REG.EXE Query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\%%A /V Title 2^>NUL ^| FIND.EXE "REG_SZ"') DO SET SDK.Title=%%C
FOR /F "tokens=3" %%B IN ('REG.EXE Query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MicrosoftSDK\InstalledSDKs\%%A /V Version 2^>NUL ^| FIND.EXE "REG_SZ"') DO SET SDK.Version=%%B
IF NOT "!SDK.Version!"=="" ECHO !SDK.Version!
EXIT /B 0
)
)
)
ENDLOCAL & EXIT /B %RC%
:Syntax
ECHO.
ECHO ListSDKs.bat, Version 1.00 for Windows XP and later
ECHO List all Microsoft SDKs with their version number,
ECHO or display the version number for a specified SDK.
ECHO.
ECHO Usage: LISTSDKS [ sdkname ]
ECHO.
ECHO Where: sdkname is the short name or keyword for an SDK
ECHO.
ECHO Notes: Run LISTSDKS without command line arguments to find the keywords
ECHO for all SDKs. These keywords are found as registry values in the
ECHO subkeys of HKLM\Software\Microsoft\MicrosoftSDK\InstalledSDKs.
ECHO If sdkname was specified but not found, the batch file will exit
ECHO with return code ("errorlevel") 1. If this help screen is
ECHO displayed, the return code will be 2 (in NT4 and later).
ECHO This batch file uses REG.EXE version 3.0. Modify the code if you
ECHO want to use it with older REG versions.
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
IF "%OS%"=="Windows_NT" EXIT /B 2
page last modified: 2024-04-16; loaded in 0.0061 seconds