Mar 23, 2025 10:35 AM
(This post was last modified: Mar 23, 2025 10:37 AM by Robert Rouge.)
if look up how to password protect a batch file, they give very not secure code
maybe like:
here is better security for password storage:
[ln]
Password: RougeSoftware
maybe like:
Code
@echo off
set /p passworld = May I ascertain your password please?:
if %passworld%==notRougeSoftware
(goto correct)
else (goto notcorrect)here is better security for password storage:
Code
@echo off
:start
::Password protection by RougeSoftware
set "rouge=echo" && set "software=Rouge Password Lock" && set "pString=Enter Password:" set "soft=Your script starts here."
set "rougeSoftware=%rouge% %software%"
%rougeSoftware%
set /p rsPass=%pString%
if not "%rsPass%"=="" (
%rouge% You entered: %rsPass%
goto hash
) else (
%rouge% The string is blank. Please enter a valid string.
goto start
)
:hash
setlocal
set "tempFile=%temp%\tempString.txt"
%rouge% %rsPass% > "%tempFile%"
for /f "tokens=*" %%i in ('certutil -hashfile "%tempFile%" SHA256 ^| findstr /v "hash" ^| findstr /v "certutil"') do (
set "correctHash=593829e39709f59c49de9418dee55505afa55e5d5c17dede12862f3cf195b62a"
set "hash=%%i"
)
if "%hash%"=="%correctHash%" (
%rouge% Correct Password
pause
cls && goto YourScriptStart
) else (
%rouge% Incorrect Password
pause
cls && goto start
)
del "%tempFile%"
endlocal
:YourScriptStart
%rouge% %soft%
pause[ln]
Password: RougeSoftware

