set msg="This is used to display information"
set psw=""
set open="d:\a\"
setlocal enabledelayedexpansion
:Main
cls
@echo off
@mode con cols=40 lines=5
if %psw%=="" goto :setset
@echo %msg%
@echo Type setting to configure it; for options you don't want to change in setting, leave them blank.
echo.
echo Please enter the password:
set /p pwdinput=""
if "%pwdinput%"=="setting" goto :checkpsw
for /F %%i in (%psw%) do (if %%i==%pwdinput% (explorer %open%) else (cls&&(echo Wrong password)&&pause>nul&&goto Main))
exit
exit
:checkpsw
cls
set /p nowpwd=Please enter the password:
if "%nowpwd%"==%psw% (goto :setset) else (cls&&goto :checkpsw)
:setset
set /p setmsg=Set the warning message to display:
set /p setpsw=Set password:
set /p setopen=Set the file to open:
if "%setmsg%"=="" set setmsg=%msg%
if "%setpsw%"=="" set setpsw=%psw%
if "%setopen%"=="" set setopen=%open%
echo set msg="%setmsg%">a.cmd
echo set psw="%setpsw%">>a.cmd
echo set open="%setopen%">>a.cmd
for /f "skip=3 delims=" %%a in (%~nx0) do (@echo %%a>>a.cmd)
copy a.cmd %~nx0
del /f /q a.cmd
call %0
For some situations where the security requirements are not high, because batch files are not confidential, you can't let people see this script.
The script is original, but it has some errors, so please help fix it.
