Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for dotnetfxver.bat

(view source code of dotnetfxver.bat as plain text)

  1. @ECHO OFF
  2. SETLOCAL ENABLEDELAYEDEXPANSION
  3. SET Verbose=0
  4. IF NOT "%~1"=="" (
  5. 	FOR %%A IN (%*) DO (
  6. 		ECHO "%%~A" | FINDSTR.EXE /R /C:"[&<>]" >NUL && GOTO Syntax
  7. 		ECHO.%%~A | FINDSTR.EXE /R /B /C:"/" >NUL
  8. 		IF ERRORLEVEL 1 (
  9. 			REM Abort if a remote computer was already specified before
  10. 			ECHO.!SystemRoot! | FINDSTR.EXE /L /B "\\" && GOTO Syntax
  11. 			REM Check if the specified computer can be reached
  12. 			PING.EXE %~1 -n 2 -4 2>NUL | FIND.EXE "TTL=" >NUL || GOTO Syntax
  13. 			REM Use remote ADMIN$ share instead of %windir%\system32
  14. 			SET SystemRoot=\\%~1\ADMIN$
  15. 		) ELSE (
  16. 			REM Check validity of command line switch
  17. 			IF /I "%%~A"=="/V" (
  18. 				IF "!Verbose!"=="0" (
  19. 					SET Verbose=1
  20. 				) ELSE (
  21. 					REM Duplicate /V switch
  22. 					GOTO Syntax
  23. 				)
  24. 			) ELSE (
  25. 				REM Invalid command line switch
  26. 				GOTO Syntax
  27. 			)
  28. 		)
  29. 	)
  30. )
  31. SET Framework=Framework
  32. REM Check if system is 64-bit
  33. IF EXIST %SystemRoot%\Microsoft.NET\Framework64\*.* SET Framework=Framework64
  34. REM List all installed .NET Framework versions
  35. FOR /D %%A IN (%SystemRoot%\Microsoft.NET\%Framework%\v?.*) DO (
  36. 	FOR /F "tokens=5" %%B IN ('FILEVER.EXE "%%~fA\mscorlib.dll"') DO (
  37. 		IF "%Verbose%"=="1" (
  38. 			CALL :VerboseName %%~B
  39. 		) ELSE (
  40. 			ECHO.%%~B
  41. 		)
  42. 	)
  43. )
  44. ENDLOCAL
  45. GOTO:EOF
  46.  
  47.  
  48. :Syntax
  49. ECHO.
  50. ECHO %~nx0,  Version 1.01 for Windows 2000 and later
  51. ECHO List installed .NET Framework versions for any computer
  52. ECHO.
  53. ECHO Usage:  %~nx0  [ remote_computer ]  [ /V ]
  54. ECHO.
  55. ECHO Where:  "remote_computer"  is an optional remote computer name
  56. ECHO                            ^(default is the local computer^)
  57. ECHO         /V                 Verbose mode: the batch file will try to return
  58. ECHO                            a description instead of just the version, e.g.
  59. ECHO                            ".NET Framework 3.5 Service Pack 1 ^(3.5.30729.01^)"
  60. ECHO                            instead of "3.5.30729.01" ^(see Notes^)
  61. ECHO.
  62. ECHO Notes:  The descriptions are based on listings from
  63. ECHO         http://support.microsoft.com/kb/318785 and
  64. ECHO         https://jonathanparker.wordpress.com/2014/12/05/
  65. ECHO         These listings are not complete.
  66. ECHO         In case a description does not exist for a version, the batch
  67. ECHO         file returns ".NET Framework" followed by the full version,
  68. ECHO         e.g. ".NET Framework 4.7.2053.0".
  69. ECHO.
  70. ECHO Written by Rob van der Woude
  71. ECHO http://www.robvandereoude.com
  72. ENDLOCAL
  73. GOTO:EOF
  74.  
  75.  
  76. :VerboseName
  77. :: This "translation" is based on listings from http://support.microsoft.com/kb/318785
  78. :: and https://jonathanparker.wordpress.com/2014/12/05/
  79. :: It is by no means complete
  80. SET VerboseName=%~1
  81. IF "%~1"=="1.0.2204.21"     SET VerboseName=1.0 Beta release 1 ^(1.0.2204.21^)
  82. IF "%~1"=="1.0.2914.0"      SET VerboseName=1.0 Beta release 2 ^(1.0.2914.0^)
  83. IF "%~1"=="1.0.3705.0"      SET VerboseName=1.0 Original release ^(1.0.3705.0^)
  84. IF "%~1"=="1.0.3705.209"    SET VerboseName=1.0 Service Pack 1 ^(1.0.3705.209^)
  85. IF "%~1"=="1.0.3705.288"    SET VerboseName=1.0 Service Pack 2 ^(1.0.3705.288^)
  86. IF "%~1"=="1.0.3705.6018"   SET VerboseName=1.0 Service Pack 3 ^(1.0.3705.6018^)
  87.  
  88. IF "%~1"=="1.1.4322.510"    SET VerboseName=1.1 Final Beta release ^(1.1.4322.510^)
  89. IF "%~1"=="1.1.4322.573"    SET VerboseName=1.1 Original release ^(1.1.4322.573^)
  90. IF "%~1"=="1.1.4322.2032"   SET VerboseName=1.1 Service Pack 1 ^(1.1.4322.2032^)
  91. IF "%~1"=="1.1.4322.2300"   SET VerboseName=1.1 Service Pack 1 Windows Server 2003 32-bit version ^(1.1.4322.2300^)
  92. IF "%~1"=="1.1.4322.2310"   SET VerboseName=1.1 KB893251 ^(1.1.4322.2310^)
  93. IF "%~1"=="1.1.4322.2407"   SET VerboseName=1.1 KB927495 ^(1.1.4322.2407^)
  94. IF "%~1"=="1.1.4322.2443"   SET VerboseName=1.1 KB953297 ^(1.1.4322.2443^)
  95.  
  96. IF "%~1"=="2.0.40607.16"    SET VerboseName=2.0 Beta release 1 ^(2.0.40607.16^)
  97. IF "%~1"=="2.0.50215.44"    SET VerboseName=2.0 Beta release 2 ^(2.0.50215.44^)
  98. IF "%~1"=="2.0.50727.42"    SET VerboseName=2.0 Original release ^(2.0.50727.42^)
  99. IF "%~1"=="2.0.50727.312"   SET VerboseName=2.0 Original release Vista ^(2.0.50727.312^)
  100. IF "%~1"=="2.0.50727.832"   SET VerboseName=2.0 KB928365 ^(2.0.50727.832^)
  101. IF "%~1"=="2.0.50727.1433"  SET VerboseName=2.0 Service Pack 1 ^(2.0.50727.1433^)
  102. IF "%~1"=="2.0.50727.1434"  SET VerboseName=2.0 Service Pack 1 Windows Server 2008 and Windows Vista Service Pack 1 ^(2.0.50727.1434^)
  103. IF "%~1"=="2.0.50727.3053"  SET VerboseName=2.0 Service Pack 2 ^(2.0.50727.3053^)
  104. IF "%~1"=="2.0.50727.3082"  SET VerboseName=2.0 Service Pack 2 ^(2.0.50727.3082^)
  105. IF "%~1"=="2.0.50727.3603"  SET VerboseName=2.0 Service Pack 2 KB974417 ^(2.0.50727.3603^)
  106. IF "%~1"=="2.0.50727.3607"  SET VerboseName=2.0 Service Pack 2 KB976569 ^(2.0.50727.3607^)
  107. IF "%~1"=="2.0.50727.3615"  SET VerboseName=2.0 Service Pack 2 KB983583 ^(2.0.50727.3615^)
  108. IF "%~1"=="2.0.50727.4016"  SET VerboseName=2.0 Service Pack 2 Windows Vista Service Pack 2 and Windows Server 2008 Service Pack 2 ^(2.0.50727.4016^)
  109. IF "%~1"=="2.0.50727.4918"  SET VerboseName=2.0 Service Pack 2 Windows 7 Release Candidate ^(2.0.50727.4918^)
  110. IF "%~1"=="2.0.50727.4927"  SET VerboseName=2.0 Service Pack 2 Windows 7 Original release ^(2.0.50727.4927^)
  111. IF "%~1"=="2.0.50727.4952"  SET VerboseName=2.0 Service Pack 2 KB983590 ^(2.0.50727.4952^)
  112. IF "%~1"=="2.0.50727.3649"  SET VerboseName=2.0 Service Pack 2 KB2833940 Windows XP and Windows Server 2003 ^(2.0.50727.3649^)
  113.  
  114. IF "%~1"=="3.0.4506.26"     SET VerboseName=3.0 Original release Windows Vista ^(3.0.4506.26^)
  115. IF "%~1"=="3.0.4506.30"     SET VerboseName=3.0 Original release (3.0.4506.30^)
  116. IF "%~1"=="3.0.4506.590"    SET VerboseName=3.0 Service Pack 1 Beta release ^(3.0.4506.590^)
  117. IF "%~1"=="3.0.4506.648"    SET VerboseName=3.0 Service Pack 1 ^(3.0.4506.648^)
  118. IF "%~1"=="3.0.4506.2123"   SET VerboseName=3.0 Service Pack 2 ^(3.0.4506.2123^)
  119. IF "%~1"=="3.0.4506.2152"   SET VerboseName=3.0 Service Pack 2 ^(3.0.4506.2152^)
  120. IF "%~1"=="3.0.4506.2254"   SET VerboseName=3.0 Service Pack 2 ^(3.0.4506.2254^)
  121.  
  122. IF "%~1"=="3.5.20404.0"     SET VerboseName=3.5 Beta release 1 ^(3.5.20404.0^)
  123. IF "%~1"=="3.5.20706.1"     SET VerboseName=3.5 Beta release 2 ^(3.5.20706.1^()
  124. IF "%~1"=="3.5.21022.8"     SET VerboseName=3.5 Original release ^(3.5.21022.8^)
  125. IF "%~1"=="3.5.30428.1"     SET VerboseName=3.5 Service Pack 1 Beta release ^(3.5.30428.1^)
  126. IF "%~1"=="3.5.30729.1"     SET VerboseName=3.5 Service Pack 1 ^(3.5.30729.1^)
  127. IF "%~1"=="3.5.30729.01"    SET VerboseName=3.5 Service Pack 1 ^(3.5.30729.01^)
  128. IF "%~1"=="3.5.30729.4926"  SET VerboseName=3.5 Service Pack 1 Windows 7 ^(3.5.30729.4926^)
  129.  
  130. IF "%~1"=="4.0.20506"       SET VerboseName=4.0 Beta release 1 ^(4.0.20506^)
  131. IF "%~1"=="4.0.21006"       SET VerboseName=4.0 Beta release 2 ^(4.0.21006^)
  132. IF "%~1"=="4.0.30128.1"     SET VerboseName=4.0 Release Candidate ^(4.0.30128.1^)
  133. IF "%~1"=="4.0.30319.0"     SET VerboseName=4.0 Original release ^(4.0.30319.0^)
  134. IF "%~1"=="4.0.30319.1"     SET VerboseName=4.0 Original release ^(4.0.30319.1^)
  135.  
  136. IF "%~1"=="4.0.30319.17020" SET VerboseName=4.5 Developer Preview ^(4.0.30319.17020^)
  137. IF "%~1"=="4.0.30319.17379" SET VerboseName=4.5 Beta release Consumer Preview ^(4.0.30319.17379^)
  138. IF "%~1"=="4.0.30319.17626" SET VerboseName=4.5 Release Candidate ^(4.0.30319.17626^)
  139. IF "%~1"=="4.0.30319.17929" SET VerboseName=4.5 Original release ^(4.0.30319.17929^)
  140. IF "%~1"=="4.0.30319.18033" SET VerboseName=4.5 January 2013 Update ^(4.0.30319.18033^)
  141. IF "%~1"=="4.0.30319.18046" SET VerboseName=4.5 May 2013 Update ^(4.0.30319.18046^)
  142. IF "%~1"=="4.0.30319.18408" SET VerboseName=4.5.1 October 2013 Update ^(4.0.30319.18408^)
  143. IF "%~1"=="4.0.30319.18444" SET VerboseName=4.5.1 February 2014 Update ^(4.0.30319.18444^)
  144. IF "%~1"=="4.0.30319.34209" SET VerboseName=4.5.2 May 2014 Update ^(4.0.30319.34209^)
  145.  
  146. IF "%~1"=="4.5.40805"       SET VerboseName=4.5 Developer Preview ^(4.5.40805^)
  147. IF "%~1"=="4.5.50131"       SET VerboseName=4.5 Beta release Consumer Preview ^(4.5.50131^)
  148. IF "%~1"=="4.5.50501"       SET VerboseName=4.5 Release Candidate ^(4.5.50501^)
  149. IF "%~1"=="4.5.50709"       SET VerboseName=4.5 Original release ^(4.5.50709^)
  150. IF "%~1"=="4.5.51641"       SET VerboseName=4.5.1 October 2013 Update ^(4.5.51641^)
  151. IF "%~1"=="4.5.51641"       SET VerboseName=4.5.1 February 2014 Update ^(4.5.51641^)
  152. IF "%~1"=="4.5.51650"       SET VerboseName=4.5.2 May 2014 Update ^(4.5.51650^)
  153.  
  154. ECHO .NET Framework %VerboseName%
  155. SET VerboseName=
  156. GOTO:EOF
  157.  

page last modified: 2024-04-16; loaded in 0.0171 seconds