Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for now.bat

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

  1. @GOTO Run
  2.  
  3. o 70 04
  4. i 71
  5. o 70 02
  6. i 71
  7. o 70 00
  8. i 71
  9.  
  10. q
  11.  
  12. :Run
  13. @ECHO OFF
  14. IF     "%~1"=="/?" GOTO Syntax
  15. IF     "%~1"=="-?" GOTO Syntax
  16. IF NOT "%~2"==""   GOTO Syntax
  17. SETLOCAL ENABLEDELAYEDEXPANSION
  18. SET H=
  19. SET M=
  20. FOR /F "skip=1" %%A IN ('DEBUG ^< "%~sf0" ^| FIND /V "-"') DO (
  21. 	IF "!H!"=="" (
  22. 		SET H=%%A
  23. 	) ELSE (
  24. 		IF "!M!"=="" (
  25. 			SET M=%%A
  26. 		) ELSE (
  27. 			ECHO.!H!%~1!M!%~1%%A
  28. 		)
  29. 	)
  30. )
  31. ENDLOCAL
  32. GOTO:EOF
  33.  
  34. :Syntax
  35. ECHO.
  36. ECHO Now.bat,  Version 1.00 for Windows NT 4 and later
  37. ECHO Display the current time with your choice of delimiter
  38. ECHO.
  39. ECHO Usage:    NOW  [ delimiter ]
  40. ECHO.
  41. FOR /F "tokens=1-3" %%A IN ('%~sf0 " "') DO (
  42. 	ECHO Returns:  %%A %%B %%C ^(hh mm ss^) with any delimiter you choose
  43. 	ECHO.
  44. 	ECHO Examples: NOW :     -^>  %%A:%%B:%%C
  45. 	ECHO           NOW .     -^>  %%A.%%B.%%C
  46. 	ECHO           NOW " "   -^>  %%A %%B %%C
  47. 	ECHO           NOW "^&"  -^>  %%A^&%%B^&%%C
  48. 	ECHO           NOW       -^>  %%A%%B%%C
  49. 	ECHO           NOW +++   -^>  %%A+++%%B+++%%C
  50. )
  51. ECHO.
  52. ECHO Based on a sample from The Starman's DEBUG Tutorial
  53. ECHO http://mirror.href.com/thestarman/asm/debug/debug2.htm
  54. ECHO.
  55. ECHO Written by Rob van der Woude
  56. ECHO http://www.robvanderwoude.com
  57.  

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