Solved How do I stop the password showing when I type?

October 1, 2014 at 13:01:58
Specs: Windows 7
I use this code to encrypt my Pictures folder although this code still does not hide the password
title Linden's Encrypter
if EXIST "{Encrypting....}" goto UNLOCK
if NOT EXIST Pictures goto MDMyFolder
echo Are you sure you want to encrypt this file? (Yes/No)
set/p "cho=>"
if %cho%==Yes goto LOCK
if %cho%==yes goto LOCK
if %cho%==Y goto LOCK
if %cho%==y goto LOCK
if %cho%==n goto END
if %cho%==N goto END
if %cho%==No goto END
if %cho%==no goto END
ren Pictures "{Encrypting....}"
attrib +h +s "{Encrypting....}"
goto End
echo WARNING Do not have Folders open when trying to encrypt.(It will not work)
echo Enter password to unlock your Encrypted folder
set/p "pass=>"
if NOT %pass%== Password goto FAIL
attrib -h -s "{Encrypting..}"
ren "{Encrypting....}" Pictures
goto End
echo Invalid password
goto end
md Pictures
goto End

See More: How do I stop the password showing when I type?

Report •

October 1, 2014 at 18:53:19
✔ Best Answer
Classic "load precedes pulling force". Attrib +h +s is so lame, I believe pre-schoolers would be amused, so why worry about masking a password? I recommend concentrating more on actual encryption, if you really care that much. There are several free versions available. This non-answer aside, there are some key-stroke masking methods on this forum (I know, because I made one), but I haven't tried them in seven or 64-bit. I used "choice.exe" in this version:
@ECHO OFF & setlocal enabledelayedexpansion
:: the second character is ESC, used to terminate input
set asc=:0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_
:: maximum length of passwd:
set passmax=8
set c=0

if %c% equ %passmax% goto :testpass
set /a c+=1

choice /s /c:%asc% /n>nul
set /a xx=!errorlevel!-1
:: ENTER / TAB can't be used to end input, ESC is arguably the next best choice
if !xx! lss 2 goto :testpass
call :yy
if !xx! equ 66 goto :getset
set qq=!qq!!xx!
set /p =*<nul
goto :getset

goto :eof

if %xx% equ 66 (
set qq=!qq:~0,-1!
rem set msk=!msk:~0,-2!
set /p = <nul
set /a c-=2
goto :eof
set xx=!asc:~%xx%,1!
goto :eof

if "%1" equ "" goto :eof
echo testing "%1" against entered item "%qq%" :
if "%qq%" equ "%1" echo PASS--------------
:: end batchscript

This one allows backspace-correction (the last character in var. "asc", #66), but unfort. ESC, or some other char than ENTER or TAB must be used for input-termination.

message edited by nbrane

Report •
Related Solutions

Ask Question