Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for winver.bat

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

  1. @ECHO OFF
  2. :: By Denis St-Pierre
  3.  
  4. VER | FINDSTR /L "5.0." > NUL:
  5. IF %ErrorLevel% EQU 0 ECHO Running 2000
  6.  
  7. VER | FINDSTR /L "5.1." > NUL:
  8. IF %ErrorLevel% EQU 0 ECHO Running XP
  9.  
  10. VER | FINDSTR /L "5.2." > NUL:
  11. IF %ErrorLevel% EQU 0 ECHO Running Win 2003
  12.  
  13. VER | FINDSTR /L "6.0." > NUL:
  14. IF %ErrorLevel% EQU 0 (
  15. 	If EXIST %SystemRoot%\System32\ServerManagerLauncher.exe (
  16. 		ECHO Running Windows 2008R1
  17. 	) ELSE (
  18. 		ECHO Running Vista
  19. 	)
  20. )
  21.  
  22. VER | FINDSTR /L "6.1." > NUL:
  23. IF %ErrorLevel% EQU 0 (
  24. 	If EXIST %SystemRoot%\System32\ServerManagerLauncher.exe (
  25. 		ECHO Running Windows 2008R2
  26. 	) ELSE (
  27. 		ECHO Running Windows 7
  28. 	)
  29. )
  30.  

page last uploaded: 2017-07-06, 12:37