Dec 172017
Check to see if a specified TSR program is in memory. If so, an ERRORLEVEL is returned to the calling program.
File CHKTSR.ZIP from The Programmer’s Corner in
Category Batch Files
Check to see if a specified TSR program is in memory. If so, an ERRORLEVEL is returned to the calling program.
File Name File Size Zip Size Zip Type
CHKTSR.COM 857 701 deflated
CHKTSR.DOC 5655 2035 deflated

Download File CHKTSR.ZIP Here

Contents of the CHKTSR.DOC file


CHKTSR tells you whether or not a specific program is currently
resident in memory. An errorlevel is returned for use in batch
files. CHKTSR may be useful in situations where a batch file or
other process requires that certain programs, primarily TSRs, be
resident (or not resident). DOS 3.0 or later is required.

To determine whether or not a program is present in memory, use

CHKTSR name [/E]

where "name" is the name of the program you're interested in.
Use only the primary file name; don't include a drive, path, or
extension. If the optional switch /E is present, CHKTSR only
returns an errorlevel; there is no display.

For example, to determine if the program "MYTSR" is loaded:

CHKTSR mytsr

CHKTSR will attempt to determine whether or not MYTSR is
currently loaded. It will then display one of the following:

Program MYTSR not found
Program MYTSR found at segment xxxx

where xxxx is the hexadecimal segment number where the program
was located (its PSP, or Program Segment Prefix address). If
the program was located more than once, multiple copies of the
"found" message will appear, one for each loaded copy.

Remember that CHKTSR won't display anything if you use /E:

CHKTSR mytsr /e

Only the errorlevel will be returned.

CHKTSR will return one of the following errorlevels:

0 Program not found
1..253 Found this many copies of program
254 Error found in DOS's memory control block chain
255 Usage error or incompatible DOS version (2.x)

Use in batch files
Here is a skeleton batch file that demonstrates how to use the
returned errorlevel correctly:

chktsr mytsr /e
if errorlevel 255 goto usage
if errorlevel 254 goto oops
if errorlevel 1 goto present
rem MYTSR is not present
rem MYTSR is loaded at least once
rem Your memory is hosed up, DOS is going to crash.
rem Not very likely to occur in this context.
rem Error in MYTSR usage, or DOS 2.x

DOS versions
Under DOS 3.0, CHKTSR may not be 100% reliable. It should never
indicate that a program is present when it is not, but there can
be situations where a program that IS present is reported as
"not found." This will generally occur when a TSR has released
its copy of the DOS environment. To be sure that CHKTSR works
with a given program, run it once when you are certain that the
program is present. Chances are that the error will be
consistent--if CHKTSR works once with the program, it will
probably always work.

You can also check with our free PMAP program, using the /D
(Detail) option. If PMAP does not show that the program you're
interested in has an environment block, then CHKTSR won't be
reliable with that program.

CHKTSR should be quite reliable under DOS 4.0 or later, and it
will not run at all under DOS 2.x (which provided no facilities
for this sort of thing).

This document and the program CHKTSR.COM are copyrighted by the
author. The copyright owner hereby licenses you to: use the
software; make as many copies of the program and documentation
as you wish; give such copies to anyone; and redistribute the
software and documentation via electronic means. There is no
charge for any of the above.

You may not charge or request donations for redistribution of
any such copies, however made; and you may not distribute the
software and/or documentation with commercial or sharware
products without prior permission in writing from the copyright
holder. An exception is granted to recognized user's groups,
which are authorized to charge a small fee for composite disks
which may contain CHKTSR, as long as the fee is intended to
cover the costs of materials, handling, postage, library
maintenance, etc., and is charged on a per-disk rather than a
per-program basis.

No copy of the software may be distributed or given away without
this document; and this notice must not be removed.

There is no warranty of any kind, and the copyright owner is not
liable for damages of any kind. By using this free software,
you agree to this.

The software and documentation are:

Copyright (C) 1989 by

Christopher J. Dunford
The Cove Software Group
P.O. Box 1072
Columbia, Maryland 21044

(301) 992-9371
CompuServe 76703,2002 [IBMNET]

 December 17, 2017  Add comments

Leave a Reply