Page 1 of 1

Mask user input (password) as stars / blank

Posted: 12 Feb 2020 00:44
by daffeyy
Hi,
I'm trying to mask user input but since I'm a newbie to CMD / batch script and trying to get my things private, I might need a little help from you all.
Here is the script (it's from Google anyway). The password is "PASSWORD".
@ECHO OFF
if EXIST "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" goto UNLOCK
if NOT EXIST Private goto MDPrivate
:CONFIRM
echo lock 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 Private "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
echo folder locked
goto End
:UNLOCK
echo enter password:
set/p "pass=> "
if NOT %pass%== PASSWORD goto FAIL
attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}"
ren "Control Panel.{21EC2020-3AEA-1069-A2DD-08002B30309D}" Private
echo Folder Unlocked successfully
goto End
:FAIL
echo invalid password
goto end
:MDPrivate
md Private
echo Private created successfully
goto End
:End
Your replies will always be useful. Thank you before. :D

Re: Mask user input (password) as stars / blank

Posted: 12 Feb 2020 03:18
by ShadowThief
There are a couple of ways to do it

viewtopic.php?t=4664
viewtopic.php?t=8442

Re: Mask user input (password) as stars / blank

Posted: 12 Feb 2020 06:15
by npocmaka_