以下代码暂仅完成一个概念性, 设计方案上我提出一些功能还未完成, 效率上也很低, 望有兴趣者共同完善与增强
代码刚刚通过初步测试, 谢谢 | @echo off & setlocal enabledelayedexpansion | | title 知识点测试小工具 | | | | | | | | | | | | | | | | | | | | | | | | | | | | >nul ( | | for /f "delims=" %%l in (%~s0) do ( | | echo,%%l|findstr /i "^:kp"&&(set "tt=%%l" & set /a sum_kp=!tt:~3!) | | ) | | ) | | echo The sum of knowledge is !sum_kp! | | pause | | | | for /l %%i in (0 0 0) do ( | | set /a ii=!random! %% sum_kp + 1 | | call :do %~s0 !ii! | | ) | | exit /b | | | | :do | | | | echo..&echo. | | set "found_kp=N" & set "QState=E" & set "AState=E" & set "RState=E" & set "A_USER=" | | for /f "delims=" %%l in (%1) do ( | | if /i "!found_kp!"=="Y" ( | | echo,%%l|findstr /i "^:kp">nul&& (exit /b)& rem 结束当前答题 | | echo,%%l|findstr /i "^Q:">nul&&( | | set "QState=S" | | ) || ( | | echo,%%l|findstr /i "^A:">nul&&( | | set "AState=S" | | )||( | | echo,%%l|findstr /i "^R:">nul&&(set "RState=S")||( | | if /i "!found_kp!!QState!!AState!!RState!"=="YSSE" ( | | set "A_STD=%%l" | | (set /p A_USER=Answer: ) | | if /i "!A_USER!"=="!A_STD!" (echo GOOD^!) else echo ERROR | | echo Standard Answer: !A_STD! | | echo Reference: | | ) else ( | | echo %%l | | ) | | ) | | ) | | ) | | ) else ( | | echo,%%l|findstr /i "^:kp">nul&& (set "tt=%%l" & set /a c_kp=!tt:~3! & if "!c_kp!"=="%2" set "found_kp=Y") | | ) | | ) | | exit /b | | | | :kp1 | | Q: | | MS 何时停止对 WIN2K 的支持? 回答格式: yyyy.mm.dd | | A: | | 2010.07.13 | | R: | | Support for Windows 2000 is ending | | On July 13th, 2010, support for Windows 2000 Server ends. The Windows 2000 End-of-Support Solution Center is the starting point for planning your migration strategy from previous versions of Windows Server. | | | | :kp2 | | Q: | | WINXP 下, 命令行启用延缓环境变量扩展名的命令 | | A: | | Setlocal EnableDelayedExpansion | | R: | | | | :kp3 | | Q: | | Windows 2000 Server 支持每台机器上最多拥有多少个处理器(请输入一个阿拉伯数字)? | | A: | | 4 | | R: | | Windows 2000 Server 面向小型企业的服务器领域。它的原名就是Windows NT | | 5.0 Server。支持每台机器上最多拥有4个处理器,最低支持128MB内存,最高支持4GB内存。COPY |
|