cl) and the linker can be determined like so C:\> cl | findstr Version C:\> link | findstr Version
| Visual Studio | cl | link | .NET Framework |
| VS 6.0 | 12.00 | ? | Last one before .NET |
| VS .NET 2002 (7.0) | 13.00 | ? | 1.0 |
| VS .NET 2003 (7.1) | 13.10 | ? | 1.1 |
| VS 2005 (8.0) | 14.00 | ? | 2.0 |
| VS 2008 (9.0) | 15.00 | ? | 3.5 |
| VS 2010 (10.0) | 16.00 | 10 | 4.0 |
| VS 2012 (11.0) | 17.00 | ? | 4.5 |
| VS 2013 (12.0) | 18.00 | ? | 4.5.1 |
| VS 2015 (14.0) | 19.00 | ? | 4.6 |
| VS 2017 RTW (15.0) | 19.10 | ? | 4.6.1 |
| VS 2017 version 15.3 | 19.11 | ? | 4.6.1 (?) |
| VS 2017 version 15.5 | 19.12 | ? | 4.6.1 (?) |
| VS 2017 version 15.6 | 19.13 | ? | 4.6.1 (?) |
| VS 2017 version 15.7 | 19.14 | ? | 4.6.1 (?) |
| VS 2017 version 15.8 | 19.15 | ? | 4.6.1 (?) |
| VS 2017 version 15.9 | 19.16 | ? | 4.6.1 (?) |
| … | |||
| 2022 | 17.x (?) |
cl can also be determiend with the compiler macros _MSC_VER, _MSC_FULL_VER and _MSC_BUILD: #include <stdio.h>
#define r(mac) #mac
#define s(txt) r(txt)
int main() {
printf("_MSC_VER = %s\n", s(_MSC_VER ));
printf("_MSC_FULL_VER = %s\n", s(_MSC_FULL_VER));
printf("_MSC_BUILD = %s\n", s(_MSC_BUILD ));
}
.SILENT: showCompilerVersion.exe: showCompilerVersion.obj link /nologo showCompilerVersion.obj /out:showCompilerVersion.exe showCompilerVersion.obj: showCompilerVersion.c cl /nologo /c showCompilerVersion.c /FoshowCompilerVersion.obj
%VisualStudioVersion% environment variable. HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7 lists all installed Visual Studio installations.