Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I have created a batch file that runs full screen and displays a lock screen. It is used at school because we cannot lock the computers. To unlock it, it requires a code.
The problem is that when the code is entered it is displayed on the screen so other people can see it.
My question is: is there a way to hide the input from a set /p command?
This is what I have so far:
*************************************
Lock Computer II.bat
-----
@ECHO OFF:header
title Lock Computer II for %username%
cls
goto start:start
echo This computer is in use and has been locked.
echo.
echo Only %username% can unlock this computer.
echo.
set unlockcode=
set /p unlockcode=Enter the Unlock Code to unlock this computer.
if '%unlockcode%'=='1234567890' goto unlock
if not '%unlockcode%'=='1234567890' goto middle:middle
cls
echo The Unlock Code you entered is incorrect.
echo.
echo Please enter the code again.
echo.
echo If the problem persists, please contact your distributor.
echo.
goto start:unlock
goto end:end
exit
---
**********************************Thankyou for your help,
David F

Hi David
For now until I or someone else can think of something better and since you are using WinXP.
You could use the "color" command to make your input less visible, for the syntax just type "color /?" at the prompt.
XP won't let you set the background and foreground to the same color, which in your case is a pity.
Hope this helps

Hi Robert
A better solution.
Type the text below into Notepad and save as Input.txt. The blank line is important and is just a carriage return.
Then enter at prompt "debug < input.txt". This creates the Input.com file.
Then use the batch file below as a test.
------------
A
MOV AH,08
INT 21
MOV DL,AL
MOV AH,02
INT 21
CMP DL,0D
JNZ 0100
MOV AH,4C
INT 21RCX
18
NINPUT.COM
W
Q
-------------
echo off
set pw=1234567890
echo Enter Password
input > pw.txt
set /p password=< pw.txt
if %password%==%pw% (
echo Password OK
)else (
echo Access Denied
)
set pw=
set password=
del pw.txt

Thanks for your replies.
When I type in "debug < input.txt" (without quotes) into the command prompt, I get this response:
-A
0B20:0100 MOV AH,08
0B20:0102 INT 21
OB20:0104 MOV DL,AL
0B20:0106 MOV AH,02
0B20:0108 INT 21
0B20:010A CMP DL,0D
0B20:010D JNZ 0100
0B20:010F MOV AH,4C
0B20:0111 INT 21
0B20:0113 RCX
^ Error
0B20:0113 18
^ Error
0B20:0113 NINPUT.COM
^ Error
0B20:0113 W
^ Error
0B20:0113 Qand CMD.exe freezes. There is no input.com file in the same folder as the input.txt file.
Any ideas?
Thanks,
David F

Hi David,
I make it a practice to put at least one
ENTER
after the
Q
One will suffice. But without it, debug hangs.
M2

d10,
I hope.
This is pretty cool stuff.
I'm always reluctant to post debug scripts.
It's a little like handing a butcher knife to a child.
Best regards
M2

Hi Mechanix
Thanks for the compliment. Youre right about danger in not doing things they do'nt really understand, but I should hope that others may benifit from them as input is offen needed in batch files and would be more usefull to the people who don't have those extra WinXP/2000 batch commands.

![]() |
Disable Desktop
|
Infix to Postfix calculat...
|

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