Articles

Batch Command Timer thingy

November 28, 2012 at 20:59:34
Specs: Windows Vista

Sorry about the title, i didnt know what to name it
anyway,
is there a way to get a batch program to have a timer running in the background while waiting for a command?

for example
the batch file says

quick type help!

you then have five seconds to type "help" or batch file opens 23 random windows
(jokes)
anyway, is this possible?
if not what will it work on?
thanks for any help

-Edit
by the way after you type help it does

goto x
( i dont know why i added this)

Domo!


See More: Batch Command Timer thingy

Report •


#1
November 29, 2012 at 08:25:14

You can issue a choice command with the default response set after n seconds.

However this command is not supported under XP and has a slightly different syntax under Win 7 (type choice /? to know how it works). More the choice is limited to ONE alphanumeric character.

Example

echo.Type h as fast as you can
choice /N /C:@,h /T:@,5
if ErrorLevel 2 goto :HELP
echo.Nothing entered


Report •

#2
December 2, 2012 at 20:33:13

thanks for the reply it really helped but it seems that the "choice" command only lets you do a key press as an input is there a way to change it so you can type a word?
do you know what i mean?

Domo!


Report •

#3
December 3, 2012 at 02:40:21

Unfortunately NO. Choice does allow a list of alphanumeric characters only, i.e. key press, and if you do a key press though a wrong one, the coundown timer is stopped. Due to the architecture of batch scripts there is no viable way to achieve what you wish.

Report •

Related Solutions

#4
December 3, 2012 at 19:39:24

all right thanks anyway

Domo!


Report •


Ask Question