I believe this should do it:
Code:
@set password=password
cls
@ECHO OFF
title Folder Locker
echo
:MENU
echo.What would you like to do?
echo.1 Unlock Folder
echo.2 Change Password
set /p "mainMenuChoice=>"
if %mainMenuChoice%==1 goto :CONTINUE
if %mainmenuChoice%==2 goto :CHANGEPASS
:CHANGEPASS
set thisbatchname=selfEdit.bat
:: echo old password: %password%
set /p newPass="Enter new password: "
pause
echo @set password=%newPass%>newfile.txt
for /f "skip=1 delims=" %%L in (%thisbatchname%) do (
echo %%L>>newfile.txt
)
move /y "%thisbatchname%" "tempname.bat" & ren "newfile.txt" "%thisbatchname%" & del "tempname.bat"
goto MENU
:CONTINUE
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK1
if NOT EXIST Locker goto MDLOCKER
:CONFIRM
echo Are you sure you 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
if %cho%==yes goto LOCK
if %cho%==Yes goto LOCK
if %cho%==yEs goto LOCK
if %cho%==YeS goto LOCK
if %cho%==yeS goto LOCK
if %cho%==YES goto LOCK
if %cho%==yES goto LOCK
if %cho%==No goto END
if %cho%==no goto END
if %cho%==nO goto END
if %cho%==NO 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}"
cls
color 0a
Echo Folder locked succefully
Echo Press enter to exit . . .
pause > nul
goto End
:UNLOCK1
echo Enter password to Unlock folder
set/p "pass=>"
if NOT %pass%== %password% goto FAIL1
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
cls
color 0a
echo Folder Unlocked successfully
Echo Press enter to exit . . .
pause > nul
goto END
:UNLOCK2
echo Enter password to Unlock folder
set/p "pass=>"
if NOT %pass%== %password% goto FAIL2
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Locker
cls
color 0a
echo Folder Unlocked successfully
Echo Press enter to exit . . .
pause > nul
goto END
:FAIL1
cls
color 0c
echo Invalid password
Echo You have one more chance . . .
Echo Press enter to try again.
pause > nul
cls
goto UNLOCK2
:FAIL2
cls
color 0c
echo Invalid password
Echo Press enter to exit . . .
pause > nul
goto END
:MDLOCKER
md Locker
echo Locker created successfully
goto End
:End
What I did:
Set a variable named password to the password on the first line (THIS MUST STAY HERE!)
Changed line 48 to the variable instead of hardcoded password
Changed line 60 to the variable instead of hardcoded password
Added :MENU, :CHANGEPASS, and :CONTINUE labels
In CHANGEPASS I added functionality to change the password on the first line.
after password has been changed, it goes back to the main menu.
If unlock (choice 1) is selected, then it goes on through the scrip as you originally had it, minus the tweaks on lines 48 and 60 that I changed.
Under :CHANGEPASS, change the "thisbatchname" to the name of your batch file that you're running.
Note that I have not actually tested this, besides testing the password change functionality of it
only. It's up to you to test to see if it actually works.