Using a technique similar to the Universal Date Parser, I have scripted
WhatTime.bat to retrieve the current time.
The syntax for using WhatTime.bat is:
call WhatTime Hour Minute Second Hsec
Where:
Hour is a call directed environment variable that will contain the 2 digit hour, 00-23. Minute is a call directed environment variable that will contain the 2 digit minute, 00-59. Second is a call directed environment variable that will contain the 2 digit second, 00-59. Hsec is a call directed environment variable that will contain the 2 digit hundredth of a seconds, 00-99.NOTE: See How can I retrieve the current time in numeric environment variables?
WhatTime.bat contains:
@echo off if \{%4\}==\{\} @echo Syntax WhatTime Hour Minute Second Hsec&goto :EOF for /f "tokens=5-8 delims=:. " %%h in ('@echo.^|time') do ( set /a %1=100%%h%%100 + 100 set %2=%%i set %3=%%j set %4=%%k ) call set %1=%%%1:~1^,2%%
0 comments
Hide comments