æéè¨æ¸¬
%TIME%ã¨ããç¹æ®ãªç°å¢å¤æ°ããããããã«ã¯ç¾å¨ã®æå»ãæ ¼ç´ããã¦ãã¾ãã
echo %TIME%
12:09:22.90
ãªã®ã§ããã®æååãåºåã£ã¦æã»åã»ç§ã«ããã°ããã§ãã
ãããããã®åã次ã®ããã«åãã¨ã
set t=%TIME% set /a m = %t:~3,2%
ç¡å¹ãªæ°åã§ããæ°å¤å®æ°ã¯ 10 é² (17 æ¡)ã16 é² (0x11 æ¡)ã ã¾ã㯠8 é² (021 æ¡) ã§ãã
ã¨ããã¨ã©ã¼ãåºã¾ããæåã0ã ã¨8é²ã ã¨è§£éããããã§ãããã ãã09ã¯æ´æ°ã«ã§ããªãã®ã§ãããã®ããã«æ¬¡ã®ããã«ãã¾ãããã
set /a m = 1%t:~3,2% %% 100
09ã®åã«1ãã¤ãã¦109ã«ãã¦100ã®å°ä½ãå¾ã¾ããããã§9ã«ãªãã¾ãã
ãã®ããã«ãã¦åæåãåã£ã¦100åã®1ç§åä½ã®æéãå¾ã¾ãããããã³ã¼ãã®å®è¡ã®éã§åã£ã¦ãããããå¼ãç®ãã¾ãããã®ã³ã¼ãã次ã§ããåãåãå¦çã®å®è¡æéãè¨æ¸¬ãã¦ãã¾ãã
@echo off set /a N = 60000 call :get_time set /a t = %ERRORLEVEL% call :sum %N% echo %ERRORLEVEL% call :get_time set /a t = %ERRORLEVEL% - %t% echo %t:~0,-2%.%t:~-2%s exit /b 0 :sum set /a s = 0 for /L %%i in (1, 1, %N%) do set /a s += %%i exit /b %s% :get_time setlocal set t=%TIME% set /a h = %t:~0,2% set /a m = 1%t:~3,2% %% 100 set /a s = 1%t:~6,2% %% 100 set /a ss = 1%t:~-2% %% 100 set /a ret = ((%h% * 60 + %m%) * 60 + %s%) * 100 + %ss% exit /b %ret%