Dec 172017
Program to read file names from a disk directory, and put them into a batch file called NAMES.BAT. Several formats are supported and TP 3.0+ source code is included.
File BATMAKR2.ZIP from The Programmer’s Corner in
Category Batch Files
Program to read file names from a disk directory, and put them into a batch file called NAMES.BAT. Several formats are supported and TP 3.0+ source code is included.
File Name File Size Zip Size Zip Type
BATMAKER.COM 18888 12554 deflated
BATMAKER.DOC 5106 2052 deflated
BATMAKER.PAS 15091 4313 deflated

Download File BATMAKR2.ZIP Here

Contents of the BATMAKER.DOC file

'* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
BATMAKER An MS-DOS Utility by Robert L. Miller
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

The BATMAKER utility is a convenience tool which makes batch files. The
idea is based on a CP/M-80 program called FMAP.COM, originally written by Ward
Christensen, which I have found useful over the years. BATMAKER will run on
ANY MSDOS 2.x system, and it has a number of different output options,
tailored to MSDOS.
BATMAKER reads file names from a disk directory and puts them into an
output batch file called NAMES.BAT. This batch file may then be run like any
other batch file, using command line arguments to fill in the replaceable
parameter %1, %2, etc.
The format of NAMES.BAT can be any one of a number of possibilities,
depending on which option letter is used. To see how to run it, just type
BATMAKER with no command line arguments:

BATMAKER version 2.00 R. L. Miller

Usage: BATMAKER Filename.Typ -0)ption Letter

Option Letter Output
============= ======
-A %1 Filename.Typ %2 %3
-B %1 %2 Filename.Typ %3 %4
-C %1 %2Filename.Typ %3 %4
-D %1 %2 %3
-E %1 >%2 %3
-F %1 %3 %4
-G %1 >%3 %4
-H -- Prints this help message --
-I %1 %2 %3 Filename.Typ %4 %5
-any other Filename.Type

Output for all options but -H go to file NAMES.BAT in current directory
Command line can handle paths, e.g.:

Each output tupe has different possible uses. For example, option -A
might be used with the COPY command. Suppose we did this:

The BATMAKER utility would read in all .COM files in the current direct
ory, sort them into alphabetical order, and spit them out into our file called
NAMES.BAT. At this point, NAMES.BAT might look like this:
%1 TURBO.COM %2 %3
%1 MAKEBAT.COM %2 %3
%1 TFLOAT.COM %2 %3

We could now run NAMES.BAT like this:
and MSDOS would substitute the word "COPY" for replacement parameter %1, "C:"
for %2, and "-V" for %3. Thus, the screen would show MSDOS doing the follow
ing 3 commands:

(On my system, I have set the "switch character" to dash ["-"]. On many
other systems it is a slash ["/"], so those people would make parameter %3 the
string "/V".)

We might think of MSDOS command lines as sentences which have nouns,
verbs, and modifiers. In the example above, "COPY" acts like a verb,
"TFLOAT.COM" acts like a noun, and the others are sort of like modifiers.
Most examples of batch files that you see put the parameters in the positions
where the "nouns" could go, and the "verbs" are explicitly typed out. An
example of that type could be used to assemble and link programs:
MASM %1,%1,%1,,
LINK %1,%1,,,

NAMES.BAT is just the opposite. It supplies the "nouns" as explicit file
names which it gets from a disk directory, but leaves the variable parameters
as place markers for the verbs you will fill in later when you use it.

We still have our copy of NAMES.BAT on drive A, so we can use it again:
which causes MSDOS to do this:

This is just a reminder to show you that, if you don't supply all the
parameters in the command line, MSDOS just puts blanks where the unsupplied
parameters would go.

I have tried to supply a lot of options for the format of NAMES.BAT. In
addition to sticking several parameters at the end of the line, which you may
or may not use, I have included options which do input/output redirection,
appending to a file, and piping.

Frankly, though, I'm not sure if I supplied ENOUGH options, or the RIGHT
KIND of options. If there's a useful option I have left out, I'd appreciate
hearing from you, even if you add it yourself.

I am releasing the executable file and the source code to the public
domain. The program is written in Turbo Pascal, version 3.0. There is one
catch, however. The directory sort uses routines in the Turbo Database
Toolbox, which I cannot give out. Therefore, you must also have Turbo
Database Toolbox in order to recompile BATMAKER.

Robert L. Miller
12810 Chesney Lane
Bowie, MD 20715

 December 17, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>