Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for avg8ver.bat

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

  1. @ECHO OFF
  2. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  3.  
  4. SETLOCAL ENABLEDELAYEDEXPANSION
  5. SET Ping=1
  6. SET RegKey=HKLM\SOFTWARE\AVG\Avg8
  7. IF NOT "%~1"=="" (
  8. 	ECHO.%* | FINDSTR /R /C:"[/?:;]" >NUL && GOTO Syntax
  9. 	PING %~1 -n 2 2>NUL | FIND "TTL=" >NUL || SET Ping=0
  10. 	SET ComputerName=%~1
  11. 	CALL :UpCase ComputerName
  12. 	SET ProgramFiles=\\!ComputerName!\C$\Program Files
  13. 	SET RegKey=\\!ComputerName!\%RegKey%
  14. )
  15. IF %Ping% EQU 1 (
  16. 	FOR /F "tokens=2*" %%A IN ('REG Query "%RegKey%" /V AvgDir 2^>NUL') DO SET AvgDir=%%~B
  17. 	FOR /F "tokens=2*" %%A IN ('REG Query "%RegKey%" /V AvgAllUsersDir 2^>NUL') DO SET AvgLog=%%~B\Log\avgupd.log
  18. 	FOR /F "tokens=5" %%A IN ('FILEVER "!AvgDir!\avgscan*.exe"') DO SET AVGVer=%%A
  19. 	FOR /F "tokens=9* delims=:" %%A IN ('TYPE "!AvgLog!" ^| FIND "Last-Modified:" ^| FIND ".Thread1]"') DO (
  20. 		FOR /F "tokens=1 delims=^|'" %%C IN ("%%~B") DO (
  21. 			FOR /F "tokens=1*" %%D IN ("%%~C") DO (
  22. 				SET AVGDef=%%E
  23. 			)
  24. 		)
  25. 	)
  26. 	ECHO.%ComputerName%	!AVGVer!	!AVGDef!
  27. ) ELSE (
  28. 	ECHO.%ComputerName%
  29. )
  30. ENDLOCAL
  31. GOTO:EOF
  32.  
  33.  
  34. :UpCase
  35. :: Converts a variable VALUE to all upper case.
  36. :: The argument for this subroutine is the variable NAME.
  37. SET %~1=!%1:a=A!
  38. SET %~1=!%1:b=B!
  39. SET %~1=!%1:c=C!
  40. SET %~1=!%1:d=D!
  41. SET %~1=!%1:e=E!
  42. SET %~1=!%1:f=F!
  43. SET %~1=!%1:g=G!
  44. SET %~1=!%1:h=H!
  45. SET %~1=!%1:i=I!
  46. SET %~1=!%1:j=J!
  47. SET %~1=!%1:k=K!
  48. SET %~1=!%1:l=L!
  49. SET %~1=!%1:m=M!
  50. SET %~1=!%1:n=N!
  51. SET %~1=!%1:o=O!
  52. SET %~1=!%1:p=P!
  53. SET %~1=!%1:q=Q!
  54. SET %~1=!%1:r=R!
  55. SET %~1=!%1:s=S!
  56. SET %~1=!%1:t=T!
  57. SET %~1=!%1:u=U!
  58. SET %~1=!%1:v=V!
  59. SET %~1=!%1:w=W!
  60. SET %~1=!%1:x=X!
  61. SET %~1=!%1:y=Y!
  62. SET %~1=!%1:z=Z!
  63. GOTO:EOF
  64.  
  65.  
  66. :Syntax
  67. 1>&2 ECHO.
  68. 1>&2 ECHO AVG8Ver.bat,  Version 1.00 for Windows 2000 and later
  69. 1>&2 ECHO Return the version of AVG8 AntiVirus and its virus definitions
  70. 1>&2 ECHO.
  71. 1>&2 ECHO Usage:  AVG8VER  [ remote_computer ]
  72. 1>&2 ECHO.
  73. 1>&2 ECHO Where:  remote_computer  is an optional computer name;
  74. 1>&2 ECHO                          (default is the local computer)
  75. 1>&2 ECHO.
  76. 1>&2 ECHO Note:   Requires FILEVER.EXE from one of the Windows Resource
  77. 1>&2 ECHO         Kits, and REG.EXE version 3.0 (native in Windows XP).
  78. 1>&2 ECHO.
  79. 1>&2 ECHO Written by Rob van der Woude
  80. 1>&2 ECHO http://www.robvanderwoude.com
  81. IF "%OS%"=="Windows_NT" ENDLOCAL
  82.  

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