• Please review our updated Terms and Rules here

HELP: DOS Batch Programming.

John Draugr

Experienced Member
Joined
Mar 16, 2007
Messages
68
Location
Yonkers, NY
Hi. I've been putting together some batch files for use on my Compaq Portable II. I'm using DR-DOS 7.0.3.

What I'm trying to do is create a batch file that when executed will emulate key strokes by a user on the keyboard.

Here is an example: We all know Control-Alt-Delete reboots a PC. Well, I'd like to create a Batch file that when executed will somehow trigger the 3 key combination without user intervention and basically reboot the system. I don't know if there is a way to do this internally, or if it is something that might require a small external dos file/program, but I'd really like to implement something like this.

Now, I only gave the Control Alt Delete explanation as an example. Currently there are two batch files I'd like to create and emulate the key press by a user on the keybaord. The feature I'm trying to trigger via a batch is the method of changing the computers speed from 8Mhz (Fast) to 6 Mhz (Slow) and vice versa. I plan on having these batch files called from a DOS menu program I am building through batch files.

If anyone has any info on how to do this, please let me know.


Thanks
John
 
For the control-alt-delete case specifically, there are little assembler programs in .COM format that can be used to reboot the machine. Instead of trying to emulate a user pressing the three magic keys, the programs just directly call the code that does a reboot.

I suspect that for other things, like simulating the hotkeys that change the speed of a machine, you will want little assembler programs that do the same thing. I know of utilities in the past that let you stuff things into the keyboard buffer, but not to emulate the actual pressing of keys.
 
I used to write extensive BAT files and I highly recommend you get a copy of
Professor Timo Salmi's BAT file tricks and tips, available here.

You probably don't need to write your own menu program as there were many available over the years.
For example, Auto Menu was pretty popular.

As for changing speeds, there were various "slow down" utilities written for use with early games
that had delay loops instead of using a timer. I imagine one of them should help you do what you want.

Andy
 
I interpreted his need for speed control as needing to access the speed control features on the system. Many systems allowed you to do a three key combination to turn 'turbo mode' on or off. That function can be accessed using assembler, just like the reboot function can. (But you have to know your machine's BIOS to do it. Some reverse engineering will be required.)
 
ahm wrote:

I used to write extensive BAT files and I highly recommend you get a copy of
Professor Timo Salmi's BAT file tricks and tips, available here.

"Professor" ha, that's a laught - he'd have you write it in TP 7 before anything else. And yes Timo there are reasons for using TP 3!!

CP/M User.
 
I agree with ahm, and I would also add that BASIC programs can be written that emulate DOS screens. That's another approach.

In addition to the book ahm suggested, there is another great book with DOS batch file tricks - plus - it contains a diskette with tons of DOS utilities and enhancements (if you can find the book with the disk still included) called "DOS Power Tools" I recommend the 2nd addition.

Let us know if you have trouble locating resources and we will see if we can help you.
 
Just to clarify, the link I gave isn't to a book.
It's a downloadable ZIP file containing a BAT programming FAQ with answers and examples.
Lots of useful stuff.
 
Back
Top