Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for lastwupd.bat

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

  1. @ECHO OFF
  2. SETLOCAL
  3. SET RegKey=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion
  4. SET RegKey=%RegKey%\WindowsUpdate\Auto Update\Results\Install
  5. FOR /F "skip=1 tokens=2*" %%A IN ('REG Query "%RegKey%" /v "LastSuccessTime"') DO SET LastWUpd=%%B
  6. IF "%~1"=="" ECHO Last successful Windows Update: %LastWUpd%
  7. ENDLOCAL & SET LastWUpd=%LastWUpd%
  8. IF "%~1"=="" GOTO:EOF
  9.  
  10.  
  11. :Syntax
  12. ECHO.
  13. ECHO LastWUpd.bat,  Version 1.00 for Windows XP
  14. ECHO Returns the date and time of the last successful Windows Update
  15. ECHO.
  16. ECHO Usage:   LASTWUPD
  17. ECHO.
  18. ECHO Return:  Displays a message with the date and time of the last
  19. ECHO          successful Windows Update, and saves this date and time
  20. ECHO          in an environment variable: LastWUpd=%LastWUpd%
  21. ECHO.
  22. ECHO Note:    Tested only in Windows XP SP3 and Windows 7 RC
  23. ECHO.
  24. ECHO Written by Rob van der Woude
  25. ECHO http://www.robvanderwoude.com
  26.  

page last uploaded: 2017-08-21, 14:26