There are third party programs that can do this. A likely solution would be a C program, however you have the tools to do this yourself with a debug script:
A
MOV AH,0C ;function flush buffer
INT 21 ;DOS call
MOV AH,0A ;function buffered input
INT 21 ;DOS call
MOV DL,AL ;store user input
MOV AH,4C ;function exit
INT 21 ;DOS call
RCX
14
N PSWDHIDE.COM
W
Q
The last line of the script is intentionally left blank. Save the script with a
scr extension and from the command line run
debug < scriptname.scrThe resulting file,
pswdhide.com, can be incorporated into your batch file to mask input at the console:
@echo off
set /p userid=Enter UserId:
:retry
set /p password=Enter password: <nul
for /f "tokens=*" %%i in ('pswdhide.com') do set password=%%i
if %password%==password goto next
cls
echo Incorrect password, Try Again
goto retry
:next
echo. & echo You are logged in!
While all this is very entertaining, the password is hiding in plain sight. This is a definite security breach. Might be better to hide the password in a file, database or even the registry. While still not 100% secure, it should slow down all but the most determined hacker.
Note: if you put
pswdhide.com in a directory on your path, any of your batch files can use it.
Good luck.