woxinfeixian93 当前离线
二级士官
@echo off color 0a setlocal enabledelayedexpansion set time1=%time:~0,-3% echo %time1% for /f "tokens=1-3 delims=: " %%a in ("%time1%") do ( set b1=%%b set c1=%%c ) set /p line3=请在址秒内输完: set time2=%time:~0,-3% echo %time2% for /f "tokens=1-3 delims=: " %%a in ("%time2%") do ( set b2=%%b set c2=%%c ) if %b1% equ %b2% (if %c1%+10 geq %c2% (goto right)) if %b1% neq %b2% (if %c1%+10 geq %c2%+60 (echo right)) else (echo 你输入有误!) pause复制代码
评分人数
CrLf 当前离线
论坛巡查
TOP
zjw767676 (心境自然)当前离线
上校
@echo off :input set t= set t=%time% set str= set /p str=请在十秒内完成输入: call :time0 "%t%" "%time%" ok if %ok% gtr 10 (echo,输入超时,请重新输入。&goto input) echo,输入时间为:%ok%秒。输入内容为:%str%。 pause exit :time0 计算时间差 (封装) @echo off&setlocal&set /a n=0&rem code 随风 @bbs.bathome.net for /f "tokens=1-8 delims=.: " %%a in ("%~1:%~2") do ( set /a n+=10%%a%%100*360000+10%%b%%100*6000+10%%c%%100*100+10%%d%%100 set /a n-=10%%e%%100*360000+10%%f%%100*6000+10%%g%%100*100+10%%h%%100) set /a s=n/360000,n=n%%360000,f=n/6000,n=n%%6000,m=n/100,n=n%%100 set "ok=%s% 小时 %f% 分钟 %m% 秒 %n% 毫秒" set /a "ok=%s%*3600+%f%*60+%m%" endlocal&set %~3=%ok:-=%&goto :EOF复制代码
zljzsmzzx 当前离线
中尉
@echo off :input set time1=%time% set/p str=请在十秒内完成输入:&cls set time2=%time% set/a delay=(%time2:~0,2%-%time1:~0,2%+60)%%60*3600+(1%time2:~3,2%-1%time1:~3,2%+60)%%60*60+1%time2:~-5,2%-1%time1:~-5,2% if %delay% gtr 10 (echo,输入超时,请重新输入。&goto input) echo,输入时间为:%delay%秒。输入内容为:%str%。 pause复制代码
Seter (.De Le Te.)当前离线
技术组成员
stuqx 当前离线
六级士官