65

How can I determine what version of the Windows SDK is installed on my computer?

I'm asking so I can install the latest version if it isn't installed already.

Alexander Abakumov
  • 13,617
  • 16
  • 88
  • 129
Matt
  • 761
  • 1
  • 5
  • 4

7 Answers7

49

On English locale at least:

dir "%ProgramFiles%\Microsoft SDKs\Windows"

should work. It is quite likely that there will be multiple versions installed, which is the right one for an one build can only be specified by that project.

Richard
  • 106,783
  • 21
  • 203
  • 265
44

The current version of the Windows SDK is stored in the CurrentVersion value of the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows CurrentVersion

and it can be retrieved using this PowerShell one-liner:

$(Get-Item "hklm:\SOFTWARE\Microsoft\Microsoft SDKs\Windows").GetValue("CurrentVersion")

enter image description here

Day
  • 9,465
  • 6
  • 57
  • 93
  • 2
    `Get-Item : Cannot find path 'HKLM:\SOFTWARE\Microsoft\Microsoft SDKs\Windows' because it does not exist.` - Running Windows 10, any idea what might be happening? – Yousuf Azad Oct 10 '18 at 16:05
  • 7
    @YousufAzad, I am late to the party, but it's (again) a Win32 / Win64 hickup. Seek `HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows` (note the `WOW6432Node` in the middle) – Knowleech Jan 21 '19 at 16:31
  • 1
    ``HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Microsoft SDKs\Windows\`` also works for me. – Tom Oct 22 '20 at 15:01
34

If you need to determine, while compiling, what major OS version of the Windows SDK is being used then you can use the VER_PRODUCTBUILD macro, which is defined in ntverp.h. For instance:

#include <ntverp.h>
#if VER_PRODUCTBUILD > 9600
// Windows 10+ SDK code goes here
#else
// Windows 8.1- SDK code goes here
#endif

In most cases this should not be necessary because a product should be designed to build with a particular platform SDK. But for some large products there may be a desired to support multiple platform SDKs. This can be particularly useful when migrating from one to another. If there is a bug in a header file (such as the bogus "#pragma pop" in the Windows 8.1 SDK version of bthledef.h) then you may need to workaround this bug, but not include the workaround when using the Windows 10 SDK or higher. This technique can also be used to give helpful error messages if the required SDK version is not installed.

Note that VER_PRODUCTBUILD only gives major OS version information, such as 8.1 versus 10. That means that VER_PRODUCTBUILD is increasingly useless as it doesn't change with the updates to Windows 10. Therefore the more likely thing to look at is sdkddkver.h and the NTDDI_WIN10_* macros. As of the Windows 10.0.17763.0 SDK NTDDI_WIN10_RS5 is now defined. So, write code like this:

#include <sdkddkver.h>
#if !defined(NTDDI_WIN10_RS5)
    #error Windows 10.0.17763.0 SDK is required
#endif
Bruce Dawson
  • 3,284
  • 29
  • 38
11

For latest versions, check under this regedit key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits

or under:

C:\Program Files (x86)\Microsoft SDKs\Windows Kits
T.Todua
  • 53,146
  • 19
  • 236
  • 237
4

Look under Control Panel / Uninstall a program. "Windows Software Development Kit - Windows X.X.X.X" (where X.X.X.X is the version). It will be listed amongst all the other software you have installed on your machine.

bobobobo
  • 64,917
  • 62
  • 258
  • 363
1

If you have Visual Studio installed, you can open a Visual Studio solution (or create one yourself), then right-click the solution in the solution explorer, and select Retarget Solution. The menu should give you a dropdown list of available Windows SDK versions.

Casey Kuball
  • 7,717
  • 5
  • 38
  • 70
1

If you have vs2019 (or any other version) installed, you can see the Windows SDK version under the workloads in the "desktop development section".

  • 2
    More specifically, select Tools > Get Tools and Features..., then expand the "Desktop development with C++" section on the right, and look for "Windows 10 SDK ()" under Optional features. – yoyo Jan 14 '22 at 20:03
  • It's worth noting that the Windows SDK version found in VS can be different than that found under Windows. In my case, Windows has 10.0.17763.132 while VS reports 10.0.19041.0. – Tyler Shellberg Feb 25 '22 at 17:01