Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for todaynow.bat

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

  1. @GOTO Run
  2.  
  3. o 70 0E
  4. i 71
  5. o 70 32
  6. i 71
  7. o 70 09
  8. i 71
  9. o 70 08
  10. i 71
  11. o 70 07
  12. i 71
  13. o 70 04
  14. i 71
  15. o 70 02
  16. i 71
  17. o 70 00
  18. i 71
  19.  
  20. q
  21.  
  22. :Run
  23. @ECHO OFF
  24. SETLOCAL ENABLEDELAYEDEXPANSION
  25. IF NOT "%~1"=="" GOTO Syntax
  26. SET Check=
  27. SET TodayNow=
  28. FOR /F "skip=1" %%A IN ('DEBUG ^< "%~fs0" ^| FIND /V "-"') DO (
  29. 	If "!Check!"=="" (
  30. 		SET Check=%%A
  31. 	) ELSE (
  32. 		SET TodayNow=!TodayNow!%%A
  33. 	)
  34. )
  35. IF 0x%Check% LSS 0x80 (
  36. 	ECHO.%TodayNow%
  37. ) ELSE (
  38. 	ECHO %TodayNow%_CMOS_RTC_NOT_SET
  39. )
  40. ENDLOCAL
  41. GOTO:EOF
  42.  
  43. :Syntax
  44. ECHO TodayNow.bat,  Version 1.10 for Windows NT 4 and later
  45. ECHO Display the current date and time without delimiters
  46. ECHO.
  47. ECHO Usage:    TODAYNOW
  48. ECHO.
  49. FOR /F %%A IN ('%~sf0') DO SET TodayNow=%%A
  50. SET TodayNow=%TodayNow:~0,14%
  51. ECHO Returns:  %TodayNow%
  52. ECHO          ^(YYYYMMDDHHmmss^)
  53. ECHO Or:       %TodayNow%_CMOS_RTC_NOT_SET if CMOS clock not set
  54. ECHO.
  55. ECHO Sources:
  56. ECHO http://mirror.href.com/thestarman/asm/debug/debug2.htm
  57. ECHO http://www.plasma-online.de/textual/download/misc/cmos_registers.html
  58. ECHO.
  59. ECHO Written by Rob van der Woude
  60. ECHO http://www.robvanderwoude.com
  61.  

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