[comp.os.msdos.misc] DOS .cmd files...

) (04/15/91)

	I'm looking for some sort of program that will create .cmd files.
A .cmd file is one that will supply a program with forced input.  What
I want to do, is to run a program that normally uses user input, but
to use forced input instead.  I've seen this done before, so don't tell
me that it isn't possible.  Here's an example:

<C:\> program < program.cmd

the program doesn't accept:

<C:\> program %1 %2 %3 ... etc...

	Any help about this will be greatly appreciated!!  

============================================================================
Daniel Goodwin                           | \\|/   Smiley next to
Worcester Polytech   fornax@wpi.wpi.edu  | --:-)  a Van de Graff
Box 1159         fornax@OACdev2.wpi.edu  | //|\     generator!
100 Institute Rd.        "Da Fornax"     |  Read my MIPS, no new VAXES.
Worcester, MA 01609-2280                 |   May the root be with you...
============================================================================

paulg@bhpmrl.oz.au (Paul Gallagher) (04/17/91)

If you're really talking:

  C:\..> program <file.cmd

Then file.cmd will be a plain ASCII file (created with anything from
edlin to Word for Windows) and contain literally everything a user
will normally type (including carriage-return/line-feed i.e. <enter> 
sequences). To make such a file, the best way is probably to enter
the command:

  C:\..> copy con file.cmd

and then type the expected user respoenses _exactly_. End the session
with <control-Z>. This will make a file called file.cmd containing all
the keystrokes you entered.

HOWEVER, this only works with program that read user input from "stdin"
to use C terminology (alias CON). Not many programs (worthwhile ones at least)
fit into this category.

If this doesn't work, there are a number of public domain programs
available that emulate user input by running in the background and stuffing
characters into the keyboard buffer, or intercepting either int9 or int16.
Off hand, I seem to remember one called "AUTOKEY" or "KEY-something". I can't
tell you where they maybe available by FTP. Again, these may or may not
work, depending on how deep into DOS/BIOS the program goes to get it's
input vis the way the "macro" program works.

Hope this helps,
Paul Gallagher.