Category : Batch File Utilities - mostly for DOS
Archive   : BATCOM1.ZIP
Filename : BATDOC.BAT

 
Output of file : BATDOC.BAT contained in archive : BATCOM1.ZIP
bat * Loading on-line HELP and DOCUMENTATION .....
bat * Written by F.Canova 10/5/83
bat * (c) Copyright 1983 by Seaware Corp. all rights reserved.

bat goto -line0

bat -header |* Routine prints general purpose header for help text
bat stack.purge |* remove any pre-typed keystrokes.
bat cls begtype
ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»\0F
end
bat type %s%s%s %h ............. Page %n
bat begtype
ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
Press: PGDN for next page, PGUP for prev page, HOME for main menu.

end
bat return

bat -scroll |* Routine accepts key for scrolling help text
bat inkey %k
bat if %k = KEY003 goto -opt0 |* Break key
bat if %k = KEY01B %L = 0 | return |* ESC key
bat if %k = KEY147 %L = 0 | return |* Home key
bat if %k = KEY149 %L = %L - 1 | cls | return |* PgUp key
bat if %k = KEY151 %L = %L + 1 | cls | return |* PgDn key
bat goto -scroll |* ignore any other key.

bat * ROUTINE TO HAVE USER GIVE A COMMAND A TRY !!
bat * %A = string which must match
bat -tryit
bat begtype

Enter your guess! ;
end
bat -tryit.loop
bat if .%a <> . skip 8 |* end of string ?
bat begtype


EXCELLENT !! - that's exactly it!

end
bat read Press the ÄÙ key to continue to next section.....
bat return
bat %b = %a $ 1 1 |* get 1st letter
bat %a = %a $ 2 |* remove it from string
bat -tryit.try
bat inkey %i |* get a key.
bat if %i = KEY020 type %b; | goto -tryit.loop
bat if %i = %b type %i; | goto -tryit.loop
bat beep goto -tryit.try

bat -line0
bat -line44
bat cls begtype
\0FÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ BATDOC ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
º Menu driven HELP and DOCUMENTATION. º
ÓÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĽ

GENERAL:\07
1. Introduction and how to use this Help.
2. The user supported concept.
3. BAT-BBS information. On-line users forum.

\0FEXTENDED BATCH LANGUAGE version 2.0\07
4. What BAT is.... an introduction.
5. Printing to display.
6. Reading data from users.
7. Making decisions and controlling program flow.
8. Using the keyboard stack.
9. Sensing program's results.
10. Assignment statements.
11. Debugging aids.
12. Additional information.

0. Exit.

END

bat -entry0
bat read Enter the number of your selection. > %A
bat if / = /%a %a = 1
bat if %a < 13 if %a > 1/ cls goto -opt%a
bat if %a < : if %a > / cls goto -opt%a
bat beep begtype
I DON'T KNOW THAT OPTION!
Just enter a number 0 to 12 and press the ÄÙ key.

end
bat goto -entry0

bat -opt0 cls begtype
Ready to leave on-line help! Press a key:

<\0FS\07>ystem <\0FD\07>emo <\0FH\07>elp
end
bat -exiting inkey %a
bat if %a = S exit
bat if %a = H goto -line0
bat if %a = D stack BATDEMO | exit
bat beep goto -exiting

bat -line1
bat -opt1 %h = INTRODUCTION | %L = 1 | %N = 1.0
bat call -header
bat begtype
This program will provide you with help information on the use of
the EXTENDED BATCH LANGUAGE version 2.0. It is designed to allow for
easy access and retrieval of information that would be harder to find
by more conventional means.

The information is broken up into multiple sections. Each section
may have several pages. To access each page in order, just keep
pressing the PGDN key. At the top of your screen is the name of the
section which you are in and the page number.

\0FNote:\07

If you wish to directly enter another section now, press the \0fHOME\07
key to return to the main menu, enter the proper \0fsection number\07 and
press the \0fÄÙ\07 key.

end
bat call -scroll | goto -line%L
bat -line2 %n = 1.1 | call -header | begtype
While in any of these sections, there are just three keys needed:

PGDN - This key will advance to the next page of any section. If
there are no more pages in the section, then it will advance
to the next section.

PGUP - This key will back up to a previous page within a section.
If there are no more previous pages within a section, it
will backup to the previous section.

HOME or ESC - Either of these keys will return directly to the
main menu. From the menu, any section can be looked at
directly by entering the section number and pressing ÄÙ.
end
bat call -scroll | goto -line%L
bat -line3 %n = 1.2 | call -header | begtype
There are several sections where you will be given questions and answers.
If you would like to peek and see answer without specifically answering it,
you can press the space bar to reveal the answer letter by letter.

One interesting facet you should know while using this on-line help
and documentation is that you are using the EXTENDED BATCH LANGUAGE
program to display and control these menus.

Never before has a batch language been so powerful on the IBM
personal computer as to be able to provide a facility like this. In
the following pages of description, we hope that you will see, as we
did, that this program has extraordinary capability which does much
more than just expand the capability of DOS. In fact, it gives new
power to your system by providing capabilities never before possible.
end
bat call -scroll | goto -line%L
bat -opt2
bat -line4 %H = USER%sSUPPORTED | %L = 4 | %n = 2.0 | call -header | begtype
ÖÄ Ä·
º PRIVATE USERS, If you are using this program and find it of value, º
º your contribution ($30 suggested) will be appreciated. º
º º
º You are encouraged to copy and share this program with other users, º
º on the conditions that the program is not distributed in modified º
º form, that no fee or consideration is charged, and that this notice is º
º not bypassed or removed. º
º º
º In appreciation of your $30 contribution, you will be provided with a º
º detailed users guide and diskette giving you complete descriptions, º
º examples, and tips on this program's use. All contributors are given º
º access to the BAT-BBS, a hot-line for assistance, tips, and updates. º
º º
º The $30 license fee (per system) is required for COMMERCIAL USERS if º
º used in a place of business or incorporated into another product. º
º º
ÓÄ (c) Copyright 1982, 1983 by Seaware Corp. All rights reserved. Ľ
end
bat call -scroll | goto -line%L
bat -line5 %n = 2.1 | call -header | begtype
For your $30 contribution, you will be provided with a detailed users
guide. This hardcopy manual has over 70 pages of descriptions, examples,
useful utilities, and tips on this program's use. It is prepunched for an
IBM binder for ready reference. You will also receive a diskette
containing the latest program version and useful utilities. All
contributors are also invited to use the BAT-BBS, an on-line forum for
user's ideas, tips, programs, and assistance. (See next section for more
information). Only with your support can we help you even more.

This concept was founded by Andrew Fugleman at Headlands Press, Inc.
with a series of software called "Freeware"(tm). I would like to thank
Andrew for his inspiration and help. Because I feel that good software
should have someone standing behind it, we at Seaware want to put your
contribution directly into support for you as our thanks of your support of
us. If you find this program of value, you are encouraged to send in your
contribution. Your support will not go unnoticed.

Seaware Corp. ðððð Post Office Box 1656 ðððð Delray Beach, FL 33444
end
bat call -scroll | goto -line%L
bat -opt3
bat -line6 %H = BAT%s-%sBBS | %L = 6 | %n = 3.0 | call -header | begtype

One of the special services we provide to EXTENDED BATCH LANGUAGE
users is through a communication medium called "BAT-BBS". This is
a direct link from you to other users, as well as Seaware.


The following list shows the many things that

BAT-BBS can provide . . .

end

bat call -scroll | goto -line%L
bat -line7 %n = 3.1 | call -header | begtype
FOR USERS WITH A MODEM:

* BAT-BBS is a hotline for your questions!

* Directly access our computer at Seaware via phone.

* It will be ready to give helpful ideas.

* Programs and Utilities are available to download.

* Users are welcome to upload their programs/ideas.

* Tips and techniques are on-line.

* Converse with other users and program author via
electronic mail.

* Receive program updates as soon as they are available.
end
bat call -scroll | goto -line%L
bat -line8 %n = 3.2 | call -header | begtype

IF YOU DON'T HAVE A MODEM:

* You can still phone the BAT-BBS if you wish to
have your questions answered via voice. A
recorder will take your message.
end
bat call -scroll | goto -line%L
bat -line9 %n = 3.3 | call -header | begtype

You can access the bulletin board service by using any 300 baud or
1200 baud modem with your computer. You should call the computer
using 7 data bits, even parity, and 1 stop bit.

You will also need a communication program such as PC-TALK III,
CROSSTALK, or Asynchronous Communication Package version 2.0. Contact
your local computer store if you need more information or help with
communication equipment or software.

Service is from 00:01 hours to 18:00 hours daily, Eastern Standard Time.
A phone number and your personal password will be supplied when we receive
your contribution.
end
bat call -scroll | goto -line%L
bat -line10 %n = 3.4 | call -header | begtype
To access BAT-BBS by modem:

1. Call the BAT-BBS phone number and wait about two rings then
hang up.

2. Call the BAT-BBS again, it will immediately answer the
phone and wait for the carrier from your modem.

To access BAT-BBS by voice:

1. Call the BAT-BBS phone number and wait about four rings.
A recorder will take your question on the forth ring.

2. You can take your time. The recorder will continue as long
as you are talking. Be sure to leave your NAME and ADDRESS for
a response.
end
bat call -scroll | goto -line%L
bat -opt4
bat -line11 %H = INTRODUCTION | %L = 11| %n = 4.0 | call -header | begtype
BAT is short for Extended Batch Language. BAT is a powerful productivity
tool for the IBM Personal Computer. It represents a significant advance in
providing a comprehensive yet easy to learn and use facility for
controlling tasks you give your computer. It can even give you on-line
documentation SUCH AS THIS!

BAT is a command programming language. It is a high level language that
can be used as a direct replacement or in conjunction with DOS batch files.
It can operate with IBM DOS versions 1.0, 1.1, or 2.x. Compared with
standard DOS batch files, BAT has superior control structures, string
handling, and user interfaces. It also has tracing facilities, and is easy
to learn and use. Many aspects of the language are like BASIC. Users of
VM/370 will also find it similar to EXECs. It seems that both "end users"
and programmers find BAT a simple and effective language.

end
bat call -scroll | goto -line%L
bat -line12 %n = 4.1 | call -header | begtype
With Extended Batch Language, you can have:

- Better control of messages to the screen

- Accept responses from the user and create responses to programs

- String handling operations (substring, length, etc.)

- Arithmetic expressions and assignments

- Comparisons and program return codes

- Search for files or tell if they exist

- Complete freedom to mix DOS and BAT commands within the same control file


Let's look at how it measures up to today's DOS......
end
bat call -scroll | goto -line%L
bat -line13 %n = 4.2 | call -header | begtype
Function DOS 1.1 DOS 2.0 Extended Batch Lang.
---------- ------- ------- --------------------
BEEP X
CALL/RTN X
CLS X X
BEGSTACK X
BEGTYPE X
EXIT X X
GOTO X X
IF Limited X
INKEY X
READ X
READSCRN X
SKIP X
STATEOF Limited X
STACK X
TYPE Limited X X
Assignments X
TRACE X
DOS Vars X X X
Global Vars X
Return Codes X X
end
bat call -scroll | goto -line%L
bat -line14 %n = 4.3 | call -header | begtype

As you can see from the previous chart, Extended Batch Language has more
power and enhanced capabilities than either DOS 1.1 or DOS 2.0. This
program uses these capabilities to solve common problems for......

The system programmer - who needs to do long sequences of tasks between
linker, compilers, debuggers, and editors. He can now create an
intelligent link between these programs. For instance, he may wish to do a
link depending on if the previous compile was successful. He can also
respond automatically from a keyboard "stack" into various utilities.

The secretary - who has several types of tasks to perform (word
processing, accounting packages, etc) and requires a simple way of changing
from one type of task to another, perhaps with optional help text.

The student - who wishes to go from one game to another without having to
learn the system commands required to make each available.

Testers - who wish to automate long, boring tests and procedures on the
personal computer. An excellent tool for a manufacturing line.
end
bat call -scroll | goto -line%L
bat -line15 %n = 4.4 | call -header | begtype

The effect of using BAT is to put "covers" on the programs and system
that it controls. A friendly, easy to use interface is easily created.
Described in these pages is a solution to batch files through the use of
BAT.

Once you have looked over the descriptions of each command, browse
through the BATDEMO.BAT file and look at the commands in operation. By
trying out some sample programs, you should be able to gain a full
understand of how to write some powerful batch files by using Extended
Batch Language.



Copyright (c) 1982, 1983 by Seaware Corp. Program by
All Rights reserved by Seaware Corp. Frank Canova

end
bat call -scroll | goto -line%L
bat -opt5
bat -line16 %H = HOW%sTO%sPRINT | %L = 16| %n = 5.0| call -header| begtype

The simplest thing to for Extended Batch Language to do is to print text
on the display. This is done by either of two commands, TYPE and BEGTYPE.

The TYPE command can be used for something as simple as saying hello!
For example:

BAT TYPE HELLO THERE

This is all that is needed. This command can be typed directly from DOS
(this is called immediate mode) or be entered into a file such as
"TRIAL.BAT" (this is called direct execution mode). To execute it as a BAT
program with the file, just type the file's name "TRIAL" from DOS and you
will see the results of the program "HELLO THERE" coming from BAT.
end
bat call -scroll | goto -line%L
bat -line17 %n = 5.1 | call -header | begtype

You can also put DOS variables into this command to display their
contents. For example, if the "TRIAL.BAT" file contained the line:

BAT TYPE HELLO THERE %1 %2

Then when we start the BAT program from DOS, we might enter:

TRIAL COMPUTER USER

DOS will automatically store the words after the program name into its
variables. Therefore, in the TYPE command, we will see contents of these
variables on the screen. The resulting message would be:

HELLO THERE COMPUTER USER
end
bat call -scroll | goto -line%L
bat -line18 %n = 5.2 | call -header | begtype

There is a second method of putting text onto the display. This is with
the BEGTYPE command. Although it will not display the contents of
variables, it is very useful for displaying large blocks of text, such as
menus. For example, if the "TRIAL.BAT" file contains:

BAT BEGTYPE
This is a large block of text. It is useful for menus. Note
that Upper/Lower case characters are displayed intact here.
The block is always ended with "END" in the first column
after the text finishes.
END

When executed, the "TRIAL.BAT" program will display:

This is a large block of text. It is useful for menus. Note
that Upper/Lower case characters are displayed intact here.
The block is always ended with "END" in the first column
after the text finishes.
end
bat call -scroll | goto -line%L
bat -line19 %n = 5.3 | call -header | begtype

There is an additional advantage to using BEGTYPE command. This command
can also highlight text to the user. This is done by using the form:
[\\hex] within the text block.

For example if the text block contained \\0F within the text, the result
would be \0F High Intensity Text ! \07.

By choosing different values, the screen attributes can be controlled to
create inverted video, blinking, underlined, and very colorful text.

An additional command CLS can be used to clear the display before
printing data. For instance, the combination "BAT CLS BEGTYPE" is quite
useful for printing menus and text such as this screen.
end
bat call -scroll | goto -line%L
bat -line20
bat begtype

\0fNOW IT'S YOUR TURN !!!\07


If the \0f%4\07 variable contains the word \0fDAY\07, what is the command to display
the words "\0fFUN DAY\07" on the display?

end
bat %A = BAT%sTYPE%sFUN%s%%4
bat call -tryit
bat -opt6
bat -line20 %H = READING | %L = 20| %n = 6.0 | call -header | begtype
In order to get input from the user, there are two available commands,
READ and INKEY.

When the command word READ is seen in the batch file, an input line is
accepted from the user. All function keys are assigned to the normal DOS
edit functions. When ENTER is pressed, the input line is assigned to DOS
variables.

Each word will be assigned in order to the variables indicated after the
READ command. When there are no more variables after the READ command to
assign, the remainder of the response is thrown away. If there are more
variables to be assigned after the READ command than there are words from
the user, these variables will be cleared out to a empty state. For
example:

BAT READ Please enter your name ==> %1 %2

This would prompt the user and wait for him to enter two words. These
words will be saved in the %1 and %2 variables.
end
bat call -scroll | goto -line%L
bat -line21 %n = 6.1 | call -header | begtype

Note that there does not have to be any variables indicated after the
command READ. In this case, BAT would wait for the enter key, throw away
any response, then continue to process the next batch file command.

end
bat call -scroll | goto -line%L
bat -line22 %n = 6.2 | call -header | begtype

In the event that you wish to get a single keystroke from the user, the
INKEY command should be used.

This command will wait for the user to enter a single key on the keyboard
and return its value in the optional variable. This key can be not only
letters, but all function keys, control keys, etc. For example:

BAT INKEY Press any key to continue... %0

When the user presses a single key, that key is saved into the variable %0.

If the key that is pressed is in the range of "!" to "z" (decimal 33 to
122) then the key saved to the optional variable. If you wish this key to be
echoed to the display, you must specifically use the TYPE command.

end
bat call -scroll | goto -line%L
bat -line23 %n = 6.3 | call -header | begtype

If the key is not in the above range, then the key will be converted to
the form "KEYxxx" where xxx is the hex value of the key. Extended key
codes will be in the range KEY100 to KEY1FF and nonextended key codes will
be in the range KEY000 to KEY0FF. Refer to Appendix G of the Basic manual
for a complete description of the various assignments of key codes.

The character does not have to be assigned to a variable. If the
variable name is not present following the command INKEY, the system will
wait for any key to be pressed from the user, and then continue processing.

end
bat call -scroll | goto -line%L
bat -line24
bat begtype

\0fNOW IT'S YOUR TURN !!!\07


We wish to create a menu with several options. At a "\0f=>\07" prompt,
the user must enter a \0fsingle letter\07 to select his option. What is
the command needed to request a single keystroke into the \0f%4\07
variable for option selection using the prompt above?

end
bat %A = BAT%sINKEY%s=>%s%%4
bat call -tryit
bat -opt7

bat -line24 %H = PROGRAM%sCONTROL | %L = 24| %n = 7.0| call -header| begtype
There are several ways of controlling the order of execution of a program
written with Extended Batch Language. GOTO, CALL, RETURN, and IF are all
commands that do this. The simplest is the GOTO command:

BAT GOTO -LABEL

If this line is put into a ".BAT" file, then it will stop execution at
this line and resume at the line within the file which contains:

BAT -LABEL

This is a unconditional branch. If the label is not present within the
file, and error will result. Note the minus (-) sign before the label
name. \0FLabels must be preceded with a minus sign.\07 This is done so
that BAT can tell the difference between a label and a command within the
language.
end
bat call -scroll | goto -line%L
bat -line25 %n = 7.1 | call -header | begtype

A CALL command is similar to a GOTO command. The primary difference is
that the line where the CALL command was is saved away. Then a branch to a
label is done, just like the GOTO command. Note that up to three lines can
be saved away at a time with this command. When a RETURN command is found,
the last line that was saved is now restored. Execution resumes at the
line following the original CALL command.
end
bat call -scroll | goto -line%L
bat -line26 %n = 7.2 | call -header | begtype
For example, if a program contains:

BAT TYPE One
BAT \0FCALL -LABEL\07
BAT \0FCALL -LABEL\07
BAT TYPE Four
BAT EXIT
BAT -LABEL
BAT TYPE Two
BAT TYPE Three
BAT \0FRETURN\07

You will see on the display:
ONE
TWO
THREE
TWO
THREE
FOUR
end
bat call -scroll | goto -line%L
bat -line27 %n = 7.3 | call -header | begtype
The final way to control the flow of an Extended Batch Language program
is to use an IF command. The general form of this command is:

BAT IF _word_ _condition_ _word_ _operation_______


Each word can be a fixed string of letters, or a variable, or a
combination of each.

The conditions can be:

< less than
= equal to
> greater than
<> not equal to

The operation can be any of the Extended Batch Language commands.
end
bat call -scroll | goto -line%L
bat -line28 %n = 7.4 | call -header | begtype
For example, all of the following IF statements will compare correctly
and execute their corresponding TYPE command. The first two statements
will initialize variables used in the IF commands.

BAT %1 = ABC
BAT %2 =

BAT IF ABC = %1 TYPE The variable contains ABC.
BAT IF %1 = abc TYPE This also matches.
BAT IF 0 <> 00 TYPE These are different lengths.
BAT IF 0 < 00 TYPE 0 has a smaller length.
BAT IF 456 > 123 TYPE Numerically, 456 is bigger.
BAT IF 456 < %1 TYPE ASCII value of 456 is smaller.
BAT IF AABCD = A%1D TYPE Token substitutions are made.
BAT IF %2 <> %1 TYPE Variables are different lengths.
BAT IF .%2 = . TYPE This matches if var is empty.
BAT IF BOX = BOX IF DOG <> CAT TYPE Did multi-if compare.
end
bat call -scroll | goto -line%L
bat -line29
bat begtype

\0fNOW IT'S YOUR TURN !!!\07


We wish to make a series of tests on a menu option that a user entered.
It is saved in the variable \0f%4\07. What command is needed to test for
the letter "\0fA\07"?

end
bat %A = BAT%sIF%s%%4%s=%sA
bat call -tryit
bat -opt8
bat -line29 %H = KEYBOARD%sSTACK| %L = 29| %n = 8.0| call -header| begtype
There is a method within the BAT language for answering questions from
programs without operator intervention. This is done by a "keyboard
stack". By entering data into the stack, you will essentially be entering
data through your keyboard when any program requests it. In this way, a
batch file can now answer questions programs may have by 'typing' them for
the user.

The keyboard stack operates in a "first-in first-out" basis. That is,
the first line of text put into the stack will be the first seen by the
program when it reads the keyboard. The second line entered will be the
second seen by the program, and so on. As long as there is text remaining
on the stack, ALL requests for data from the keyboard will actually come
from the stack. Once the stack has been emptied by the program, data will
then come from the keyboard as usual.

There are two commands which store data into the stack, STACK and
BEGSTACK. Here's some more about them.....
end
bat call -scroll | goto -line%L
bat -line30 %n = 8.1 | call -header | begtype
The STACK command is very much like the previously mentioned TYPE
command. Instead of displaying to the screen, it will "push" data into the
keyboard stack area. When any program is ready to accept information from
the keyboard, the parameters after the STACK command will be used as input.
For example:

BAT * This program will issue remarks to DOS.
BAT %1 = HELLO
BAT STACK REM THIS IS A REMARK FOR DOS
BAT STACK REM VARIABLE %%1 = %1

When executed, the following will appear on the screen:

A>REM THIS IS A REMARK FOR DOS

A>REM VARIABLE %1 = HELLO
end
bat call -scroll | goto -line%L
bat -line31 %n = 8.2 | call -header | begtype
The second command used to stack data is BEGSTACK. This command is
equivalent to BEGTYPE previously described. It is useful for dumping large
amounts of data to the stack area. Although no parameter substitution is
performed, there are several advantages to its use.

First, if a line ends with the ";" (semicolon) character, a carriage
return will NOT be stacked. Second, if "\\HEX" is used where HEX is a

number from 01 to FE, then this exact keyboard value will be stacked. This
is useful for stacking special control characters and symbols. Third, if
"\\00\\HEX" is used, an extended key code will be stacked. This is useful
for stacking function keys and the like. Refer to the Basic manual in
Appendix G under "Extended Codes". Fourth, if \\FF\\HEX is used, the stack
will delay the keyboard characters from appearing to the program for HEX
number of CPU "ticks". There are about 12 hex (18 decimal) ticks per
second in the CPU. In all cases, the word HEX above represents a two digit
hexadecimal number. Finally, \\\\ can be used to stack a single backslash.

Some examples...
end
bat call -scroll | goto -line%L
bat -line32 %n = 8.3 | call -header | begtype
Some examples of BEGSTACK command::

BAT BEGSTACK
\\09 Will stack the tab key.
This text will be stacked ;ÿ
on one line!
\\00\\3B Will stack an F1 key.
\\\\ is seen as one backslash.
\\FF\\24 will pause two seconds.
end


Hint: Some programs remove keystrokes before accepting a critical key. In
some cases this can be avoided by using \\FF\\01 in the BEGSTACK command.
end
bat call -scroll | goto -line%L
bat -line33 %n = 8.4 | call -header | begtype
There are also three control commands which are associated with the stack:

STACK.OFF - Redirects data to come directly from
the physical keyboard. Does not remove
any data in the stack.

STACK.ON - Directs data to come from the stack.
This is the default.

STACK.PURGE - Removes any data from the stack and
keyboard buffers which are pending.
end
bat call -scroll | goto -line%L
bat -line34
bat begtype

\0fNOW IT'S YOUR TURN !!!\07


From our menu, we wish to start up a communications program and
automatically dial a phone number with a smartmodem. The communications
program we have will take what is typed on the keyboard and send it to the
modem. The command needed for the modem to dial our phone is
"\0fATD12\07". What Extended Batch Language command will force the
communication program to dial this modem command?

end
bat %A = BAT%sSTACK%sATD12
bat call -tryit
bat -opt9
bat -line34 %H = GETTING%sRESULTS!| %L = 34| %n = 9.0| call -header| begtype
The results of programs often need to be known so that some action can
take place after the program ends.

When the command word READSCRN is seen in the batch file, a line of text
is read from the display screen into variables. Having the ability to read
text from the display can be useful for determining the result of another
program, or making a query for some system status which would not normally
be available within a batch file. For example, by reading a directory from
the screen, a series of files can be submitted to the macro assembler.
Once the assembly is completed, the status can be read from the screen to
determine if there were errors which would stop the link step. Virtually
any message which a program can generate can be used as feedback to a batch
file by using READSCRN.
end
bat call -scroll | goto -line%L
bat -line35 %n = 9.1 | call -header | begtype
Its operation is very much like the READ command except for the fact that
the information which is being read is coming from the display screen and
not the keyboard. Like the READ command, the text from the screen is
tokenized (separated at word boundaries and assigned to variables). The
return code %R will be reflect the line number on the display that was
read. This number will be in the range of 1 to 25 for the top to bottom
lines respectively. Once a line is read, this command will be set to read
the previous line. Repeated READSCRN commands will read UP the display!

For example:
BAT CLS
BAT TYPE HELLO THERE
BAT READSCRN %A %B %C

After execution:
%A contains HELLO
%B contains THERE
%C contains nothing, it is empty.
%R (return code) contains 1, the line number that was read.
end
bat call -scroll | goto -line%L
bat -line36
bat begtype

\0fNOW IT'S YOUR TURN !!!\07


From our menu, we have started the IBM Macro Assembler program. We know
that when this program ends, it will display a number representing the
number of errors that were found. We want to make sure that this number is
zero before continuing to the LINK program. If we save this number in the
variable \0f%A\07, what is the command to read the assembler result from
the display?

end
bat %A = BAT%sREADSCRN%s%%A
bat call -tryit
bat -opt10
bat -line36 %H = ASSIGNMENTS| %L = 36| %n = 10.0| call -header| begtype
If the first character in the command is a '%' (Percent sign), then it is
considered to be an assignment statement. The first variable cannot be any
predefined variable (such as %R or %%), but may be any of the other
variables %0 to %9 and %A to %O. If a DOS command is later executed and
uses one of the variables %0 to %9, it will be properly replaced with the
contents of that variable.

The first assignment token, the operator, and the final tokens are optional.
The assignment statement must appear in one of the following forms:

\0f[var] = ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ\07- create empty variable
\0f[var] = [string] \07- simple assignment
\0f[var] = [number] + [number] \07- addition
\0f[var] = [number] - [number] \07- subtraction
\0f[var] = [number] * [number] \07- multiplication
\0f[var] = [number] / [number] \07- division
\0f[var] = [string] # \07- string length
\0f[var] = [string] $ [index] [length] \07- create substring (like MID$ in BASIC)
end
bat call -scroll | goto -line%L
bat -line37 %n = 10.1 | call -header | begtype
\0f[var]\07 - A DOS variable or global user variable %0 to %9 and %A to
%O. It may not be a predefined variable.

\0f[string]\07 - Any valid token. Letters, numbers, any variable, or any
combination there of. 123, ABC, and 987%J4SF are all valid strings.

\0f[number]\07 - Any token with a numeric result in the range of 0 to
65535. For example (if %A contains 34) the three numbers 98, %A, and 12%A5
(equivalent to 12345) would all be valid numbers. Note that numbers are
always positive and should never contain a sign ( + or - ) character.

\0f[index]\07 - Same restrictions as [number] above except that an
[index] in the range 17 to 65535 is meaningless and is equivalent to the
number 16.

\0f[length]\07 - Same restrictions as [number] above except that a
[length] in the range 16 to 65535 is meaningless and is equivalent to the
number 15. Note that [length] is optional and has a default value of 15.

end
bat call -scroll | goto -line%L
bat -line38
bat begtype

\0fNOW IT'S YOUR TURN !!!\07


We wish to count the number of times that a user has used a certain .BAT
program. We will keep this count in the global user variable \0f%A\07
which will stay active even BETWEEN batch file execution. What is the
command needed to increase the value in this variable by one?

end
bat %A = BAT%s%%A%s=%s%%A%s+%s1
bat call -tryit
bat -opt11
bat -line38 %H = DEBUGGING%sAIDS| %L = 38| %n = 11.0| call -header| begtype
As an aid in debugging, the TRACE.ON command enables a trace flag which
causes each line in the BAT program to be printed as it is executed. Three
'+' (plus) symbols will precede the BAT statement which is printed out as
an aid. The trace can be turned off at any time by the TRACE.OFF command.

A trace can be active during DOS commands within the BAT program. In
addition, trace can be enabled/disabled at any time, even in immediate
mode. Once enabled, it will remain in effect until the TRACE.OFF command
is executed. Errors, execution of other BAT language files, and even
executing DOS commands will not change the trace mode.
end
bat call -scroll | goto -line%L
bat -opt12
bat -line39 %H = ADDITIONAL%sINFO| %L = 39| %n = 12.0| call -header| begtype
The size of the keyboard stack defaults to 512 bytes. This value can be
changed by making the first statement which is executed by the Extended
Batch Language program be of the form: BAT * size. Size is the decimal
number of bytes to reserve for the stack. This must be executed, for
instance, when a system reset is performed because once this area is
installed, the size is never altered until another system reset.

There are additional variables %A thru %O (oh) which are called "global
user variables". These variables are used exactly like the variables
supplied by DOS (%0 to %9) with two exceptions. First, the contents of
these variables are maintained between execution of batch files for as long
as the system is powered on. This "global" feature is useful for keeping
indicators BETWEEN "sessions" of the user. Second, because DOS does not
know about these variables, they \0fcannot\07 be used as variables within
any DOS command. So while "COPY %1 %2" is valid, "COPY %A %B" is not. If
you wish to use them within DOS commands, they must first be copied via a
statement like "BAT %1 = %A".
end
bat call -scroll | goto -line%L
bat -line40 %n = 12.1 | call -header | begtype
PREDEFINED VARIABLES...

A return code is available at memory address [0000:04FE]. If set by a
program, BAT can read this byte value with the variable %R. The string
stored into this variable is in hex with leading zeros truncated.

The current default drive is stored into the %V variable. It is a single
character.

The status of the stack is stored into the %Q variable. It is a "K" if
the READ command will be reading from the keyboard, and a "S" if it will be
reading from the stack area.

There are two character literals. %S represents a space literal and %%
represents a percent sign. Either of these special variables can be stored
into other variables, or used for testing special cases.
end
bat call -scroll | goto -line%L
bat -line41 %n = 12.2 | call -header | begtype
The STATEOF command will search all disk drives for the existance of a file.
The name after the word STATEOF can be a specific name, general name with
wildcard characters (e.g. *.EXE), or it can be a name with a specific drive
specification (e.g. A:PE.EXE). In the last case, only drive A: will be
searched instead of all available drives. Note also that a variable can be
used instead of a file name. In this version of BAT, only files in the
current directory (no paths) can be found.

The return code variable %R is used to indicate the result of the search
for STATEOF. The results are:

0 - File found on default drive.
1 - File not found.
9 - Invalid file name specified.
A to D - Same as return code 0 but instead of being found on the
default drive, it was found on drive A, B, C, or D.
end
bat call -scroll | goto -line%L
bat -line42 %n = 12.3 | call -header | begtype
If a you wish to put more than one command on a line, the vertical bar
"|" is useful. When used with an IF command and the test for the IF
conditions fail, the entire rest of the line will be ignored. Multiple
commands within a BAT statement is very useful when combined with the IF
command. For example:

BAT IF %A = abc TYPE this | CALL -that | GOTO -other

If a comment is needed within a BAT program, the "*" (star) character is
useful. When used after the word BAT, all characters which follow will be
ignored. For example:

BAT * This is a comment to the programmer.
end
bat call -scroll | goto -line%L
bat -line43 %n = 12.4 | call -header | begtype
That's about all the help there is!

If you still need more information, you might wish to contribute in order
to receive a complete users guide and password to the BAT-BBS hot-line. The
manual gives complete descriptions on all available commands with examples
of each. It is prepunched for an IBM binder for ready reference. With
the BAT-BBS, you can receive tips from other users and program updates just
as soon as they are available. We feel that user supported software should
be a two way street. With your help, it will work.

If you find this program valuable, a contribution ($30 suggested) will be
appreciated. To see further benefits of contributing and for more
information, see section 2 of this document.


Seaware Corp.
Post Office Box 1656
Delray Beach, FL 33444
end
bat call -scroll | goto -line%L


  3 Responses to “Category : Batch File Utilities - mostly for DOS
Archive   : BATCOM1.ZIP
Filename : BATDOC.BAT

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/