Powered by GeSHi

Source code for cmosdst.bat

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

  1. @GOTO Run
  2.  
  3. o 70 0b
  4. i 71
  5.  
  6. q
  7.  
  8.  
  9. :Syntax
  10. ECHO.
  11. ECHO CMOSDST.bat,  Version 1.00 for Windows NT 4 and later
  12. ECHO Check if Daylight Saving Time is enabled for the CMOS clock
  13. ECHO.
  14. ECHO Usage:    CMOSDST
  15. ECHO.
  16. ECHO Returns:  On screen text: Clock Daylight Saving Time DISABLED or ENABLED
  17. ECHO           Return code (errorlevel) 0 = DISABLED, 1 = ENABLED
  18. ECHO.
  19. ECHO Written by Rob van der Woude
  20. ECHO http://www.robvanderwoude.com
  21. GOTO :End
  22.  
  23.  
  24. :Run
  25. ::@ECHO OFF
  26. :: Check Windows version
  27. IF NOT "%OS%"=="Windows_NT" GOTO Syntax
  28. :: Check command line (no arguments required)
  29. IF NOT "%~1"=="" GOTO Syntax
  30. :: Localize variables
  31. SETLOCAL
  32. :: Read bit 0 of CMOS register 11
  33. FOR /F "skip=1" %%A IN ('DEBUG ^< "%~sf0" ^| FIND /V "-"') DO SET /A DST = "0x%%~A %% 2"
  34. :: Display the result on screen and set returncode
  35. IF %DST% EQU 0 (
  36. 	ECHO CMOS Clock Daylight Saving Time DISABLED
  37. 	ENDLOCAL
  38. ) ELSE (
  39. 	ECHO CMOS Clock Daylight Saving Time ENABLED
  40. 	ENDLOCAL
  41. 	COLOR FF
  42. )
  43. :End
  44.