本帖最后由 batman 于 2011-6-28 08:13 编辑
给个示例你吧:- @echo off&setlocal enabledelayedexpansion
- set "str=0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
- for %%a in (%str%) do set /a n+=1&set ".!n!=%%a"
- :lp
- for /l %%a in (1,1,9) do (
- cls&set /p=请输入八位由数字和字母组成的密码,请注意大小写:<nul
- if defined pwds set /p=!pwds!<nul
- if %%a neq 9 (
- choice /n /cs /c %str: =%
- set "pwds=!pwds!*"&call,set "pwd=!pwd!%%.!errorlevel!%%"
- )
- )
- echo,&echo,&echo %pwd%
- if "%pwd%" equ "BatHomes" (
- echo 密码正确
- ) else (
- echo 密码错误
- )
- pause>nul
复制代码 同时建议楼主好好看看这个贴子:
http://www.bathome.net/viewthrea ... mp;highlight=choice |