Since MS-DOS 6.* the
MEM command features the
As I will show, we can use the /M parameter to let batch files check wether TSRs or device drivers are loaded or not.
But first, the syntax as given for PC-DOS 7:
Displays the amount of used and free memory in your system.
|MEM||[ /CLASSIFY | /DEBUG | /FREE | /MODULE modulename ] [/PAGE]|
|/CLASSIFY or /C||Classifies programs by memory usage. Lists the size of programs, provides a summary of memory in use, and lists the largest memory block available.|
|/DEBUG or /D||Displays status of all modules in memory, internal drivers, and other information.|
|/FREE or /F||Displays information about the amount of free memory left in both conventional and upper memory.|
|/MODULE or /M||Displays a detailed listing of a module's memory use.
This option must be followed by the name of a module, optionally separated from /M by a colon.
|/PAGE or /P||Pauses after each full screen of information.|
Use the /M parameter, combined with the FIND command, to check if a TSR or device driver is loaded:
MEM /M ANSI | FIND "following" > NUL IF NOT ERRORLEVEL 1 ECHO ANSI is loaded
This batch file uses one line of MEM /C's output:
ANSI is using the following memory:
If ANSI is not loaded in memory, this line will not be displayed.
Consequently, FIND will produce an errorlevel of 1.
In the same way, you might use:
MEM /C | FIND "ANSI" > NUL IF NOT ERRORLEVEL 1 ECHO ANSI is loaded
This method is less DOS version dependent, as far as the usage of
MEM /C is concerned.
You will have to check, however, if FIND will produce an errorlevel dependent on its search result, in your particular DOS version.
|page last uploaded: 26 February 2013, 13:17|