Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for savver.bat

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

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

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