Re: set /P annoyance

8 views
Skip to first unread message

Herbert Kleebauer

unread,
Jan 7, 2006, 11:27:22 AM1/7/06
to
John Dill wrote:

>
> Here is something I use for collecting a passwd using Herbert's code,
> so if there's a way to modify it to make the characters visible as I
> type, that would make my day.

Here is an input program where the user can decide whether the
input is hidden or not. If he press <backspace> at the start of the
line, the input is hidden otherwise not.

For W2k/XP:

@echo off
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(Lu(LX(LeZRR]EEEUYRX2Dx=>inp.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU WwX0GwUY Wv;ovBX2Gv0ExGIuht6>>inp.com
echo supk`LGKsL{OBaswCG@gs@EbBy?x@x@GG{??xOt`B?B_r@mRpEDClpHrHj>>inp.com
echo MLtlH[EEDKi@BB?AzAE`LRsCjnEy?xpH@w?@zAB`LrG_G?0xxxxxxxxxxx>>inp.com

echo Enter your name:|inp.com>nul
for /f %%i in ('inp.com') do set input=%%i
del inp.com
echo.
echo Hello %input%


For Win9x/Me (works also in W2k/XP) you have to use:

echo set input=|inp.com>input.bat
echo.
echo Enter your name:|inp.com>nul
inp.com >>input.bat
call input.bat
del input.bat
del inp.com
echo.
echo Hello %input%

The source code:

@=$100
_30: eor.w r5,r5
_10: move.b #$08,m0
trap #$21
cmp.b #$0d,r0
beq.b _20
move.b r0,buf1
move.b r0,buf2(r5.w)
move.b #$40,m0
move.w #buf1,r1
move.w #1,r2
cmp.b #$08,r0
bne.b _50
move.w #3,r2
subq.w #1,r5
bcc.b _40
inc.w r5
eor.w r2,r2
eor.w r4,r4
_40: dec.w r5
br.b _60
_50: or.w r4,r4
bne.b _60
move.b #'*',buf1
_60: move.w #2,r3
trap #$21
inc.w r5
br.b _10

_20: move.b #$40,m0
move.w #buf2,r1
move.w r5,r2
move.w #1,r3
trap #$21
rts.w
buf1: dc.b $08,$20,$08
buf2:

Reply all
Reply to author
Forward
0 new messages