I have scripted TypeHidden.bat to hide a user's response to a sensitive prompt, like a password.

The syntax for using TypeHidden.bat is:

TypeHidden "Your Message" Response


                              "Your Message" is the message you want typed to the user.                              Response       is a call directed environment variable that will contain the hidden response.
Because the user cannot see their response, they are asked to Please re-type to confirm your entry.

NOTE: This works on Windows XP and later.

TypeHidden.bat contains:

                              @echo off                              if \{%2\}==\{\} @echo Syntax: TypeHidden "Your Message" Respnse&goto :EOF                              setlocal                              set msg=%1                              set vb="%temp%\pw_%RANDOM%.vbs"                              set msg=¥%msg%¥                              set msg=%msg:¥"=%                              set msg=%msg:"¥=%                              set msg=%msg:¥=%                              echo WScript.Echo CreateObject("ScriptPW.Password").GetPassword>%vb%                              :nq                              @echo %msg%                              for /f "tokens=*" %%a in ('cscript.exe //Nologo %vb%') do (                               set response=%%a                              )                              set response=%response:"=¥%                              @echo Please re-type to confirm your entry.                              for /f "tokens=*" %%a in ('cscript.exe //Nologo %vb%') do (                               set confirm=%%a                              )                              set confirm=%confirm:"=¥%                              if "%response%" NEQ "%confirm%" goto nq                              set response=%response:¥="%                              del /q %vb%                              endlocal&set %2=%response%