Computing.Net > Forums > Disk Operating System > How do I hide keyboard input in a batch

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 do I hide keyboard input in a batch

Reply to Message Icon

Name: gmstone
Date: June 18, 2001 at 19:24:03 Pacific
Comment:

I'm trying to write a batch file that accepts a password as input (to go into an env variable) but I don't know how to have it either not echo or echo astrixes (***) instead of what is actually typed. Can anyone share some wisdom?



Sponsored Link
Ads by Google

Response Number 1
Name: World Library
Date: June 19, 2001 at 14:37:32 Pacific
Reply:

Haven't a clue.....but if you use the ansi.sys, you could have the input be the same color as the background and thus invisable.

Ok befor I get zapped for this "inviso stuff" it is just off the top of my head.

W.L.


0

Response Number 2
Name: Secret_Doom
Date: June 19, 2001 at 17:35:41 Pacific
Reply:

Hi.
WL is right, that's a way to do it. I have developed a batch file just like that.
ANSI.SYS MUST BE LOADED INTO MEMORY.
Check if there's a line refeering to it at config.sys (should be something like "DEVICE=C:\WINDOWS\COMMAND\ANSI.SYS)
If there isn't such a string, add it (make a search for ansi.sys into your computer and then enter the right path into the line)

Ok, here's the batch. I'm assuming you're using an english dos. If not, letmeknow.

::pass3.bat
@echo off
:loop
SET PASS=
echo on
prompt $e[=0m
prompt $e[=37m
prompt $e[=40m
echo off
cls
echo *** Type password ***
prompt $e[=0m
prompt $e[=37m
prompt $e[=47m
echo on
REM ----------------------------------------------------------------------------
@echo off
FC nul con /n /lb1 |DATE |find "1:">OUT.BAT
ECHO SET PASS=%%5> enter.bat
call out.bat
if not "%PASS%"=="abc123" goto loop
SET PASS=
del enter.bat
echo on
prompt $e[=40m
prompt $P$G
cls

The password for that batch is abc123.
Any further questions, letmeknow
please keep me informed of your progress!

-- Secret_Doom --

email: secret_doom@hotmail.com

PS: I must warn ya: batch files don't offer any security at all. You can't stop user from editing the batch and find out the password. I has only effects if you're looking for security against dossed persons.


0

Response Number 3
Name: Secret_Doom
Date: June 19, 2001 at 17:37:37 Pacific
Reply:

...about this part:

REM ----------------------------------------------------------------------------

that's one single line...


0

Response Number 4
Name: Laurence
Date: June 20, 2001 at 02:56:52 Pacific
Reply:

Here is one that illustrates the masking you are after:
http://home7.inet.tele.dk/batfiles/monthly/jul2000.htm

True, you can also use ansi.sys for masking effect. You can also use an echo command which does not include the CR/LF (carriage return/line feed) characters, such as here:
http://home7.inet.tele.dk/batfiles/main/batchfaq.htm#79

Secret_Doom is right about a password batch file not being too secure, but it also depends on where and how it is used. In some cases it is very secure.

Here is a version of input.bat which includes a verification.

http://home7.inet.tele.dk/batfiles/main/batchfaq.htm#input2.bat



0

Response Number 5
Name: Laurence
Date: June 20, 2001 at 03:00:02 Pacific
Reply:

If you just want to hide keyboard input,
you can also set screen colors to black on
black (for example) with ansi.sys.

Choice may also be used.


0

Related Posts

See More



Response Number 6
Name: gmstone
Date: June 20, 2001 at 18:18:33 Pacific
Reply:

Guys, I appreciate your input. Let me give you a little more info on what I'm trying to do. This file will help me logon to an NT domain in dos so I can build machines with Ghost. NT will be authenticating the password so I need to put password into an environmental variable that can load at the end of the boot process. I'm not concerned with security because the temp file that contains the password is deleted before anyone else gets to the machine. The batch file works fine now, I just get ribbing from my co-workers because their password echos to the screen when they use it to attach to the network. After I submitted this question, I found batchman.com that lets me move the cursor to off the screen (line 26) while they enter their password, & that's acceptable, but I'd still like to use *** instead of actual input. I'll put a Reader's Digest version in another follow-up.


0

Response Number 7
Name: gmstone
Date: June 20, 2001 at 18:22:48 Pacific
Reply:

Here is what I have now.
It uses be.exe & getvar if your familiar.
Either way I think the logic is easy to follow.
------------------------------------------
echo off
cls

%bepath%\be.exe rowcol 12 20 "Enter your LanID: " green
%bepath%\getvar userid > %bepath%\STDOUT.BAT

%bepath%\be.exe rowcol 16 20 "Enter your password: " green
a:\BATCHMAN setcursor 26,22
%bepath%\getvar password >> %bepath%\STDOUT.BAT

CALL %bepath%\STDOUT.BAT

DEL %localpath%\STDOUT.BAT


0

Sponsored Link
Ads by Google
Reply to Message Icon

Batch File Variables himem.sys



Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: How do I hide keyboard input in a batch

How do i run an application in dos? www.computing.net/answers/dos/how-do-i-run-an-application-in-dos/8155.html

Passing date to a program in batch. www.computing.net/answers/dos/passing-date-to-a-program-in-batch/3008.html

how do i have a program to run on www.computing.net/answers/dos/how-do-i-have-a-program-to-run-on/14495.html