在这个批处理文件中,我试图创建一个程序,用户可以在其中输入他或她想要的密码,并在他们打开或关闭批处理文件时使用它。问题是我无法获取用户密码和(在:MDLOCKER 和:UNLOCK)以及脚本的解锁部分工作。当最终让它工作时,它接受任何密码
,如果你能提供帮助,那将非常感谢。
enter code here@ECHO OFF
prompt Filelocker`enter code here`
:START
echo what do you want to do? (insert number)
echo 1 Lock current folder
echo 2 Unlock current folder
echo 3 Make new locked folder
set/p "cho=>"
if %cho%==1 goto CONFIRM
if %cho%==2 goto UNLOCK
if %cho%==3 goto NEW
echo not valid
goto start
: NEW
title Folder Locked files
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto ALREADY
if NOT EXIST Locker goto MDLOCKER
:ALREADY
echo folder already exist!
echo try unlocking if folder can not be found
pause
goto START
:CONFIRM
echo Are you sure u want to Lock the folder(Y/N)
set/p "cho=>"
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
echo Invalid choice.
goto CONFIRM
:LOCK
ren Locker "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo Folder locked
goto end
:MDLOCKER
md Locker
echo Locked folder created....
echo folder is now created
echo enter password for your file.
set/p 1%=
echo password accepted
goto start
:UNLOCK
echo Enter password to Unlock folder
set/p "pass=>"
if NOT %pass%==%1% goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
echo Folder Unlocked successfully
goto End
:FAIL
echo Invalid password
echo 2 MORE TRYS LEFT
pause
goto
:End