當前位置:成語大全網 - 新華字典 - 我想用批處理來生成密碼字典,用戶輸入密碼長度,自動生成字典文件dictionary.txt

我想用批處理來生成密碼字典,用戶輸入密碼長度,自動生成字典文件dictionary.txt

@echo off

setlocal enabledelayedexpansion

set y=9999999999

set fileexist=no

set overwrite=y

set /p n=input a number:

set topath="c:\dictionary.txt"

if exist %topath% echo 已經存在同名文件&set fileexist=yes

:c

if "%fileexist%"=="yes" set /p overwrite=是否覆蓋已有文件(y覆蓋寫入,n追加寫入):

if "%overwrite%"=="y" (

del %topath% /f

) else (

if not "%overwrite%"=="n" echo 輸入有誤,只能輸入y或n&goto c

)

for /l %%i in (1,1,!y:~-%n%!) do (set qq=0000000000%%i

echo !qq:~-%n%!>>%topath%)

echo 密碼文件已經保存到%topath%

pause