Clear typeahead buffer in DOS

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
miskox
Posts: 555
Joined: 28 Jun 2010 03:46

Clear typeahead buffer in DOS

#1 Post by miskox » 26 Mar 2012 09:10

Hi all,

I was wondering if this is possible to achieve in DOS.

ZX Spectrum code:

Code: Select all

10 IF INKEY$ <>"" THEN GO TO 10 
20 IF INKEY$ ="" THEN GO TO 20


OpenVMS DCL code:

Code: Select all

$ set term/notypeahead


I was doing some repeating tasks. After a specific tasks completed I used a

set/p to wait for ENTER key to be pressed because I had to do something else and the process *must* wait.

So, I accidently pressed the ENTER key twice.

I would like to avoid this. Is there a way to clear a typeahead buffer? So that the key presses are not remembered? If I press the ENTER key twice (or 3+ times) it will not remember this.

Thanks,
Saso

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: Clear typeahead buffer in DOS

#2 Post by abc0502 » 26 Mar 2012 09:14

why don't you make the order to continue is a another key like "a, b, .." and enter key to it will confirm the order
i think it will be easier :)

You can make it '+Enter key

tonysathre
Posts: 14
Joined: 20 Mar 2012 10:07

Re: Clear typeahead buffer in DOS

#3 Post by tonysathre » 26 Mar 2012 10:50

This may be what you're looking for:

doskey /keysize:1

Tony

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Clear typeahead buffer in DOS

#4 Post by foxidrive » 26 Mar 2012 17:02

miskox wrote:I was doing some repeating tasks. After a specific tasks completed I used a

set/p to wait for ENTER key to be pressed because I had to do something else and the process *must* wait.



Use this to start your process with the wait option.

start "" /w "c:\folder\precess.exe"

Post Reply