批处理实现复杂密码(包含大小写字母数字符号)

来源:互联网 发布:微信墙用什么软件 编辑:程序博客网 时间:2024/05/04 17:15

声明:欢迎批评指正


目标:生成12位密码,4位为一组分别放入大写字母,数字,小写字母和字符


运行方法:分别保存为“复杂密码.bat”和"zdb.txt",运行复杂密码.bat即可


运行环境:win7 32位


更新:更新了zdb.txt,特殊字符前面加^,比如zdb.txt中的^改成^^


复杂密码.bat(bat是后缀名)

@echo offsetlocal enabledelayedexpansionset key=for /L %%i in (1,1,12) do (set /a dig=%%i%%4if !dig! EQU 1 (set /a n1=!random!%%25set idx1=0for /L %%a in (1,1,25) do (if !n1! EQU !idx1! (set /a num=%%a)set /a idx1+=1))if !dig! EQU 2 (set /a n2=!random!%%10set idx2=0for /L %%b in (26,1,35) do (if !n2! EQU !idx2! (set /a num=%%b)set /a idx2+=1))if !dig! EQU 3 (set /a n3=!random!%%24set idx3=0for /L %%c in (36,1,59) do (if !n3! EQU !idx3! (set /a num=%%c)set /a idx3+=1))if !dig! EQU 0 (set /a n4=!random!%%9set idx4=0for /L %%d in (60,1,68) do (if !n4! EQU !idx4! (set /a num=%%d)set /a idx4+=1))set idx=1for /F %%j in (zdb.txt) do (if !num! EQU !idx! (set key=!key!%%j)set /a idx+=1))@echo key is:!key!pauseexit
zdb.txt
ABCDEFGHIJKLMNPQRSTUVWXYZ0123456789abcdefghijkmnpqrstuvwxyz~^!^@#$^%^^^&*


阅读全文
0 0