phprompt -- Enter input without echo
--- Freeware ---

[page last modified 6/30/2014]

phprompt is a Windows 32-bit command line (ie DOS box) program to get a line of user input without echoing the characters typed. I use it to enter passwords in a .BAT file.

The traditional way to prompt for input in a .BAT is via SET /P, eg:

    SET /P input=Enter your name:
This is a problem if you want to enter a password, for a couple reasons: (1) the password is displayed onscreen; and, (2) the password is placed in the command history. (2) means even if you carefully hide the screen while entering the password, and your .BAT does a CLS to clear the screen after entry, someone can still press the up arrow at the command prompt later to reveal what was typed.

phprompt avoids these security issues by getting characters from the keyboard without echoing them -- not even . or * is displayed to show the entry length. Non-printable characters (function keys, arrow keys, etc) are ignored.

The couple dozen lines of C source is provided; it is freeware, there are no restrictions on its use, but no guarantee is given.

Prompts for non-echoed user input -- Ver 1.0, 2014 PaulHoule.com

A prompt is written to the stderr device, then the user enters
a line of input via stdin (not echoed as it is keyed).  Upon
completion, the entire user input line is written to stdout.

Could be used in a batch file something like this:
  for /f "delims=" %%p in ('phprompt "PW? "') do set pw=%%p

 Usage:  phprompt text

text:  Prompt written to stderr, eg: "Enter password: "

version 1.0 released 6/30/2014:  Initial Win32 version.

Click here to download  phprompt10.zip

You are visitor 2618       Go to Home Page