CHOICE fallthrough?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Cat
Posts: 32
Joined: 11 Nov 2011 12:04

CHOICE fallthrough?

#1 Post by Cat » 13 Dec 2011 19:04

I am writing a code to mask user password input, since there is no command for this. Here is what i have:

Code: Select all

@echo off
setlocal enabledelayedexpansion
set chars=q w e r t y u i o p a s d f g h j k l z x c v b n m 1 2 3 4 5 6 7 8 9 0
:input
cls
echo input password:
if defined display echo %display%
choice /c "!chars: =!" >nul
if not %errorlevel%==37 (
   for /f "tokens=%errorlevel%" %%a in ("%chars%") do set input=%%a
   set password=%password%%input%
   set display=%display%*
   goto input
) else (
   echo your password is: %password%
   pause
)
exit

A-Z and 0-9 are all used. What can be used to create a fallthrough for CHOICE?

Post Reply