Reputation:
I have to use Microsoft SDK
directory path in my c#
code. In Win 7
i can easily get it by following line(hard-coded):
string path = Path.GetFullPath("C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin");
Is there any kind of path exist in win xp
or win 98
?
where are netsh.exe
are present in xp
or 98
?
Upvotes: 22
Views: 66506
Reputation: 4570
It should be noted that anything said below might have changed by the time you read this. The structure and content of the Windows SDK has evolved over time and will likely continue to evolve.
Windows SDKs are named for the version of Windows that they target. For example, at the moment the current SDK is named The Windows 10 SDK for Windows 10, version 1803. It targets Windows 10 version 1803 also known as Windows 10 April 2018 Update. The version number for that version of Windows is 10.0.17134.
The default install location for a Windows SDK is \Program Files\Windows Kits\10
on 32-bit systems and \Program Files (x86)\Windows Kits\10
on 64-bit systems.
Within the install folder are a number of sub-folders - e.g., include
, lib
, bin
, etc. Within each of those sub-folders are other subfolders named for the version number of the Windows release targeted - e.g. 10.0.17134.0
, 10.0.16299.0
, etc.
So, the full path to a tool like mlgen.exe
on a system with the letter C assigned to the disk drive is C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x86
for the 32-bit code file and C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64
for the 64-bit code file.
From an old SDK install it appears that the SDK targeting the Windows 10 Anniversary Edition (version 10.0.4393) did not use the "Windows version number" sub-folder.
Previous SDKs have targeted Windows 8 \Program Files (x86)\Windows Kits\8.0
and Windows 8.1 \Program Files (x86)\Windows Kits\8.1
. Those earlier versions of the SDK also don't use the "Windows version number" sub-folder (at least the ones I have lying around don't).
Going even further back in time, SDKs used to install into a folder called Microsoft SDKs
rather than Windows Kits
. For example, the Microsoft Windows SDK for Windows 7 (7.1) installed by default into \Program Files\Microsoft SDKs\Windows\v7.1\
or \Program Files (x86)\Microsoft SDKs\Windows\v7.1\
.
Of course anyone performing an install might choose to use a different install folder.
Ideally the SDK path should not be hard-coded in any program since it may change for different SDK versions and on different systems.
The question How to programatically detect and locate the Windows 10 SDK? offers some alternatives.
Upvotes: 37