Computing.Net > Forums > Windows 2000 > how to mask input in command-prompt

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

how to mask input in command-prompt

Reply to Message Icon

Name: albert2u
Date: July 5, 2007 at 03:23:37 Pacific
OS: windows2000
CPU/Ram: 2GB
Product: Dell
Comment:

Dear all,

I am trying to get a user name in the first input and get the password for the 2nd Input.

Now, I am facing a problem to mask the password. Does anyone know how not to reveal it when user is keying in the password?

It will be something like this:
@echo off
set INPUT=
set /P INPUT=Username: %=%
set /P INPUT2=password: %=%
if "%INPUT%"=="" goto input
echo Your Name was: %INPUT%

Thanks in advance!



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 5, 2007 at 04:55:11 Pacific
Reply:

I don't know of any 'native' way to hide keystrokes.

BTW, you don't have a label :input to goto.


=====================================
If at first you don't succeed, you're about average.

M2



0

Response Number 2
Name: FishMonger
Date: July 5, 2007 at 10:27:43 Pacific
Reply:

You'll need to use a scripting language that can control the terminal.

Here's a Perl example.

====================================================

#!perl

use Term::ReadKey;

print "What's your name? ";
chomp($name = <STDIN>);

ReadMode 2;
print "What's the password? ";
chomp($password = <STDIN>);

ReadMode 0;
print "\nSorry $name, but '$password' is the wrong password, good bye.\n";



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows 2000 Forum Home


Sponsored links

Ads by Google


Results for: how to mask input in command-prompt

HOW TO REBOOT WIN2000 FROM COMMAND PROMP www.computing.net/answers/windows-2000/how-to-reboot-win2000-from-command-promp/31192.html

font options in command prompt www.computing.net/answers/windows-2000/font-options-in-command-prompt/58644.html

delete directories in command prompt www.computing.net/answers/windows-2000/delete-directories-in-command-prompt/23774.html