@echo off
if not exist bb.txt
for /f "delims=" %%i in (bb.txt) do set passwords=%%i
:begin
cls&set /p password= Please enter the password:
if "%password%"=="%passwords%" goto ok
cls&echo Wrong password&ping /n 2 127.1>nul&goto begin
:set
set select=2
cls&set /p select= Change the password? (default is not to change if you just press Enter): (1. Change 2. Do not change)
if %select% equ 1 goto change
if %select% equ 2 goto ok
if %select% neq 1 if %select% neq 2 goto wrong
:change
set /a n=%random%%%38,m+=1
call,set pwd=%pwd%%%code:~%n%,1%%
if %m% lss 16 goto change
echo :: %pwd%>>%~nx0
cls&echo Please keep your new password safe: %pwd%&pause&goto :eof
:wrong
cls&echo Invalid input, please enter the correct choice!&ping /n 2 127.1>nul&goto set
:ok
cls&echo Correct password!&pause&goto :eofThis code was written by someone else. My idea is:
if the BB.txt file does not exist, then display a prompt (if it exists, then run the password verification program according to bb.txt)
For first-time use, please set a password:
Then save it to BB.txt
When running the program again next time
───────────────── Moderator record ─────────────────
Executed by: HAT
Action: added search keywords to the thread title
Explanation: the original title "Everyone help me see how to modify this code" was not helpful for forum searching
Penalty: deducted 2 credits
Reminder: it is recommended to read the following threads
{1415}The Wisdom of Asking Questions
{7326}Forum newbie must-read, the basic code of conduct for everyone
{22703}Please don't be an impetuous person
{32667} Those people who can't even write a clear title, wake up
{32825}Strict cleanup of lousy posts in this section
───────────────── Moderator record ─────────────────
[ Last edited by HAT on 2008-12-13 at 22:56 ]
