Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Capturing Keystrokes in MS-DOS

508 views
Skip to first unread message

Larry Weiss

unread,
Apr 15, 2000, 3:00:00 AM4/15/00
to
Rana Mehmood wrote:
> Can somebody tell me how to capture keystrokes in a batch file in a
> Windows/MS-DOS environment.

Use con-e.bat (listed below). Then you can execute

con-e XXX

and environment variable XXX will get set to whatever the user types
in until the Enter key is typed.

@echo off %con-e.bat%
if (%1)==() goto 900
type ZLF.tmp >ZLF.tmp
echo @echo off>enter.bat
echo if (%%1)==() goto 900>>enter.bat
echo shift>>enter.bat
echo shift>>enter.bat
echo shift>>enter.bat
echo shift>>enter.bat
echo set %1=%%1>>enter.bat
echo shift>>enter.bat
echo :100>>enter.bat
echo if (%%1)==() goto 999>>enter.bat
echo set %1=%%%1%% %%1>>enter.bat
echo shift>>enter.bat
echo goto 100>>enter.bat
echo :900>>enter.bat
fc con ZLF.tmp /lb1 /n | date | find " 1: ">>enter.bat
echo :999>>enter.bat
call enter.bat
del enter.bat
del ZLF.tmp
goto 999
:900
echo usage: con-e envvar
echo sets the specified environment variable to input from console
echo example:
echo con-e XXX
echo will capture whatever the user enters into environment var XXX
:999

- Larry Weiss

Rana Mehmood

unread,
Apr 16, 2000, 3:00:00 AM4/16/00
to

Ted Davis

unread,
Apr 16, 2000, 3:00:00 AM4/16/00
to

Any reasonable answer to that depends on what you mean by "capture"
and "keystrokes" - knowledge of the operating system could be critical
as well.

"Capture" could mean "discard", "save", "save multiples in a string",
or "identify", and "keystrokes" without modification means any of the
100+ keys on the any keyboard ever built, many of which are
non-printing and very difficult to deal with without a special built
program in a high-level language.

A precise statement of the problem is needed.


T.E.D. (tda...@gearbox.maem.umr.edu - e-mail must contain "batch" in the subject or my .sig in the body)

Michael J. Gregg

unread,
Apr 17, 2000, 3:00:00 AM4/17/00
to
Not sure if this is what your looking for, but try downloading SCANCODE,
this will allow you to force keys into a
program...

Download here: http://members.aol.com/bretjohn/programs/scncd590.zip

"Rana Mehmood" <rmeh...@prodigy.net> wrote in message
news:en8K4.7708$fF5.3...@news1.rdc1.il.home.com...

0 new messages