Powered by GeSHi

Source code for dnfxver.bat

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

  1. @ECHO OFF
  2. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  3. IF NOT "%~1"==""            GOTO Syntax
  4. IF NOT EXIST GetUnIns.vbs   GOTO Syntax
  5. FINDSTR.EXE /? 2>NUL | FIND.EXE /I "expression" >NUL || GOTO Syntax
  6. REG.EXE     /? 2>NUL | FIND.EXE /I "query"      >NUL || GOTO Syntax
  7.  
  8. SETLOCAL
  9. :: Variable thjat holds the results and is used to prevent duplicates
  10. SET AllLines=;
  11. :: Use GetUnIns.vbs to list all programs with ".NET Framework" in their
  12. :: names, and FIND.EXE and FINDSTR.EXE to filter out hotfixes and SDKs
  13. FOR /F "tokens=3*" %%A IN ('CSCRIPT.EXE //NoLogo "%~dp0GetUnIns.vbs" /F:".NET Framework" ^| FINDSTR.EXE /R /I /C:"Program Name  *= .*\.NET Framework [1-9]" ^| FIND.EXE /I /V "Hotfix" ^| FIND.EXE /I /V "SDK" ^| SORT.EXE') DO CALL :Display %%B
  14. ENDLOCAL
  15. GOTO:EOF
  16.  
  17.  
  18. :Display
  19. :: Skip duplicates
  20. ECHO.%AllLines% | FIND.EXE /I ";%*;" >NUL && GOTO:EOF
  21. :: Add version to list, to check for duplicates later
  22. SET AllLines=%AllLines%%*;
  23. :: Display the version found
  24. ECHO.%*
  25. GOTO:EOF
  26.  
  27.  
  28. :Syntax
  29. ECHO dNFxVer.bat,  Version 1.01 for Windows 2000 and XP
  30. ECHO List installed .NET Framework versions
  31. ECHO.
  32. ECHO Usage:  DNFXVER.BAT
  33. ECHO.
  34. ECHO Note:   This batch file requires my GETUNINS.VBS script in its parent folder.
  35. ECHO.
  36. ECHO Written by Rob van der Woude
  37. ECHO http://www.robvanderwoude.com
  38.