Chapter 10. Working with System Information

Changing the Date and Time

In Chapter 5, ”Understanding Files and Directories,” you learned a bit about how DOS stores files using a directory. This directory maintains critical information about each file on your disk, including the filename, its attributes, its size, and where it is stored on the disk. It also contains date and time information that indicates when the file was last updated. This information is often referred to as a date and time stamp. This stamp is updated from the system date and time whenever you make changes to the file.

Your computer uses a battery-powered clock to maintain the date and time used by your system. Even when the computer is turned off, power from the battery goes to the chip containing the clock, and the date and time remain current.

Setting the date and time becomes increasingly important as you create more files on your computer. Because the DOS file-naming rules limit you to only eight characters in the root filename and three characters in the file extension (which is generally used to indicate the file type), the names of your files might not be very descriptive. In this situation, you might need to rely on the date and time stamp to tell which file is the most recent. On computers without a clock or with a clock that has a dead battery, however, the date and time are set to the same value each time you turn on the computer. This situation makes it difficult for you—or DOS—to tell the difference between an old file and a revised or new file. In addition, some DOS commands work by comparing file dates. If your system time and date are not correct, these commands will have little value to you.

Occasionally checking your computer's date and time is worthwhile. All batteries eventually fail and need replacing. All clocks in personal computers lose time. How much time your clock loses depends on the programs you run on your computer.

The clock that keeps the date and time in a PC is controlled by an electronic component in the computer—the system timer. This chip is the heartbeat of the computer. Everything the computer does takes a known amount of time. The system timer provides a regular pulse that controls all the functions occurring in the computer.

One of these functions is to update the clock that DOS uses to tell the time (and consequently the date). Commands or other programs that cannot afford to be interrupted while they're working tell DOS not to interrupt them until they finish what they're doing. A typical example is a communications program that waits for a character to be sent from another computer. If DOS is busy performing other tasks, such as updating the clock, the program might miss the character. Consequently, this type of program disables the interrupts; the program tells DOS to do nothing else for the period that it needs full control. During these times, the clock is not updated. These periods are typically only a fraction of a second, but the effect is cumulative, and eventually the time loss is noticeable.

If you do not have an AUTOEXEC.BAT file (see Chapter 2, “Starting DOS”), DOS displays the current date and time when you start your computer and gives you the opportunity to change them. You should take a moment to check these settings. Make sure that you set the date and time correctly whenever you are prompted because both are used in many DOS operations.

Most people, however, use an AUTOEXEC.BAT file. This file seldom contains the commands necessary to change the date and time. In these instances, DOS uses its current settings. If you later notice that the date and time are incorrect (for example, a newly created file might contain the wrong date and time), you should change them by using the DATE and TIME commands.

Issuing the DATE Command

DATE is an internal command that is simple to use. It has only one possible parameter, as shown in the following syntax:

DATE today

If you type DATE at the DOS prompt and then press Enter, DOS shows you the date currently being used by your system and then prompts you for a new date:

Current date is Fri 08-17-2001
Enter new date (mm-dd-yy):

The date that is displayed might or might not be correct; you can change it by entering a new date or accept it by pressing Enter. Alternatively, if you don't want to see what the current date setting is, you can enter the DATE command followed by the date you want your system to use.

The exact format you should use for entering a date depends on the country code set in your CONFIG.SYS file. (Chapter 14, “Understanding the International Features of DOS,” includes a discussion of the country code settings.) The date format can be one of the following formats:

Country Code Format
North America
mm-dd-yy
mm-dd-yyyy
Europe
dd-mm-yy
dd-mm-yyyy
East Asia
yy-mm-dd
yyyy-mm-dd

mm is the month, dd is the day, and yy and yyyy are the year. To set the date to December 23, 2001, on a machine configured for North America, for example, you can enter the following line at the DOS prompt:

DATE 12-23-2001

If you use two digits instead of four, DOS will assume that the first two digits should be 19. Rather than the hyphen, you can use periods or slashes as separators. Leading zeros are not required. If the month is January, for example, you can use 1 (instead of typing 01) for the month.

If you want to change the date, letting DOS prompt you is the best way to use this command because the current date setting appears in the correct format, and you can copy this format rather than remember it. The DOS screen might appear as follows if you let DOS prompt you for the current date:

C:>DATE
Current date is Fri 08-17-2001
Enter new date (mm-dd-yy): 12-23-2001

Pressing Enter when DOS prompts you for a new date retains the current setting. If you don't enter the date correctly or if you select a date that is outside the range supported by DOS, you see the error message Invalid date, after which you can again try to enter a date.

Issuing the TIME Command

Closely related to the DATE command is the internal TIME command. It also has only one possible parameter:

TIME now

As with DATE, if you type only TIME and press Enter at the DOS prompt, DOS shows you the current time setting and prompts you for a new one. You can change the time without being prompted by including the new time on the command line as a parameter.

When you enter a new time setting, you do so using hours, minutes, and seconds. The exact format you should use depends on the country code setting in your CONFIG.SYS file.

You can use either a 12-hour or 24-hour clock. The following line shows the format used for a 24-hour clock:

hrs: mins: secs. 1/100secs

hrs is the hour, a number from 0 to 23; mins is the minutes, a number from 0 to 59; secs is the seconds, a number from 0 to 59; and 1/100secs is the number of one-hundredth seconds, a number from 0 to 99. The 24-hour clock starts with midnight as 00:00.00. You can use a period rather than a colon when separating the hours, minutes, and seconds, or a comma in place of a period when separating the seconds from the hundredths of a second.

If you decide to enter the time using a 12-hour clock, the format is the same as for the 24-hour clock except that hrs is a number from 1 to 12, and you add a or p to signify a.m. or p.m. If you do not add an a or a p, DOS assumes a.m.

Just because DOS enables you to enter time to the nearest 1/100 of a second, you don't need to. In fact, you don't need to enter all the parts of the time. DOS sets any missing elements to zero (using the 24-hour clock notation). To set the time to 8:25 p.m., for example, you can enter one of the following lines at the DOS prompt:

TIME 20:25

TIME 8:25p

Either command sets the time to 8:25 p.m. The seconds and hundredths of a second are set to zero. To set the clock to 12:30 a.m., you can enter the following line:

TIME :30

As with the DATE command, letting DOS prompt you for the time is the easiest way to use this command. When DOS displays the current time, all you need to do is enter a new time using the same format. Following is an example of how the DOS screen might appear if you let DOS prompt you for the current time:

C:>TIME
Current time is 2:35:07.23p
Enter new time: 2:40p

You can use the COUNTRY command to change the format DOS uses to display the time (see Chapter 14).

Displaying the Version Using the VER Command

DOS includes an internal command that displays the DOS version currently in use. Knowing how to use the VER command is invaluable if you ever work with an unfamiliar computer. Some commands, such as DISKCOMP, FORMAT, and XCOPY, work differently or are not available with different DOS versions. If you do not know which version of DOS a computer is using, the VER command can tell you.

When you enter the VER command at the DOS prompt, you see a message similar to this one:

MS-DOS Version 6.20

This is the DOS version used to boot your computer. If a computer with a hard disk is booted from a floppy disk, the version of DOS might not be what you expected. Suppose that your hard disk is formatted for DOS 6.2, but you use a DOS 5.0 floppy disk to boot your computer. The Version 6.2 commands on your hard disk might not work while your computer is running a different version of DOS. In this instance, the following message appears when you try to use one of the DOS 6.22 commands:

Incorrect DOS Version

Sometimes DOS can be slightly different even within the same version. Some computer manufacturers supply DOS packages specially designed to work with their machines, so you might see a different message if you use a different product. Compaq Computer Corporation's version of DOS, for example, includes Compaq's name with the version number. Because of the differences between these versions, you might be able to track down problems on an unfamiliar computer more easily if you first determine the exact DOS version number and its manufacturer.

Setting the Version Using the SETVER Command

When a new version of DOS is released, some time passes before software manufacturers can upgrade popular applications programs to take full advantage of DOS's new features. Many programs ask the operating system to tell them which version of DOS the computer is running. If a program does not recognize the version of DOS in memory, it might refuse to run. One or more of your applications, therefore, might refuse to run because they have not been certified by the manufacturer to run properly with DOS 6.22.

You can get a reluctant program to run under DOS 6.22 in two ways:

  • Contact the software manufacturer or your dealer to find out whether you need a program upgrade.

  • Use the SETVER command to add the name of the program to DOS 6.2's version table. The version table is a list of programs with DOS version numbers listed next to them. When a program listed in the version table loads into memory and asks DOS for its version number, DOS reports the version number listed in the version table rather than the actual version number—6.2. The application is fooled into running under DOS 6.2.

The first option is the better choice. By checking with the manufacturer, you can determine whether the software has been tested in DOS 6.22.

Warning

If you use SETVER, you run the risk, however slight, that your program might become corrupted if it is incompatible with DOS 6.2.

The SETVER command operates as both a device driver and an executable command. Before DOS can use the version table, you must load SETVER.EXE as a device driver. Make sure that the command is included in your CONFIG.SYS file so that it executes every time you start your computer. If SETVER.EXE is not in your CONFIG.SYS file, you need to add it. To do so, use the following syntax:

DEVICE=d:pathSETVER.EXE

The parameters d: and path are the disk and directory that contain the SETVER.EXE external program file. When you installed DOS, the installation program created a default CONFIG.SYS file for you, which includes the following command:

DEVICE=C:DOSSETVER.EXE

After the device driver SETVER.EXE is loaded into memory, DOS can use the version table to report different DOS versions to applications programs listed in the version table.

To see whether a particular program is already in the version table, use SETVER from the DOS command line. To do so, type SETVER at the DOS prompt; do not add switches, filenames, or parameters. DOS displays a two-column listing with program names in the first column and the DOS version number the programs will work with in the second column. Microsoft has already tested the programs listed in the initial version table and determined that they operate properly in DOS 6.22. The version list that appears on your screen should resemble the following list:

KERNEL.EXE      5.00
NETX.COM        5.00
NETX.EXE        5.00
NET5.COM        5.00
BNETX.COM       5.00
BNETX.EXE       5.00
EMSNETX.EXE     5.00
EMSNET5.EXE     5.00
XMSNETX.EXE     5.00
XMSNET5.EXE     5.00
DOSOAD.SYS      5.00
REDIR50.EXE     5.00
REDIR5.EXE      5.00
REDIRALL.EXE    5.00
REDIRNP4.EXE    5.00
EDLIN.EXE       5.00
BACKUP.EXE      5.00
ASSIGN.COM      5.00
EXE2BIN.EXE     5.00
JOIN.EXE        5.00
RECOVER.EXE     5.00
GRAFTABL.COM    5.00
LMSETUP.EXE     5.00
STACKER.COM     5.00
NCACHE.EXE      5.00
NCACHE2.EXE     5.00
IBMCACHE.SYS    3.40
XTRADRV.SYS     5.00
2XON.COM        5.00
WINWORD.EXE     4.10
EXCEL.EXE       4.10
LL3.EXE         4.01
REDIR4.EXE      4.00
REDIR40.EXE     4.00
MSREDIR.EXE     4.00
WIN200.BIN      3.40
METRO.EXE       3.31
WIN100.BIN      3.40
HITACHI.SYS     4.00
MSCDEX.EXE      4.00
NET.EXE         4.00
NET.COM         3.30
NETWKSTA.EXE    4.00
DXMA0MOD.SYS    3.30
BAN.EXE         4.00
BAN.COM         4.00
DD.EXE          4.01
DD.BIN          4.01
REDIR.EXE       4.00
SYQ55.SYS       4.00
SSTDRIVE.SYS    4.00
ZDRV.SYS        4.01
ZFMT.SYS        4.01
TOPSRDR.EXE     4.00

When you run one of the programs listed in the first column of the version table, DOS reports to the program the DOS version number listed in the second column.

If you try to run a program and it displays an error message stating that you are using an incompatible version of DOS, you might want to try adding the program to the version table. Enter the SETVER command using the following syntax:

SETVER filespec n.nn

The filespec parameter indicates the full name of the file in question, including a path, a filename, and an extension. The n.nn parameter is a DOS version number that the program will recognize. Consult the program's documentation to determine with which versions of DOS the program can run.

You also can use SETVER to delete program names. The syntax for using SETVER to delete programs from the version table is shown in the following line:

SETVER filespec /DELETE /QUIET

The two switches—/DELETE and /QUIET—can be abbreviated as /D and /Q.

For an example of how you use SETVER, assume that you want to run a program called GOODPROG.EXE, but the program runs only with DOS versions 3.0 to 3.3. To add GOODPROG.EXE to the version table, type the following command at the command prompt and press Enter:

SETVER GOODPROG.EXE 3.30

DOS displays the following series of messages, including an initial warning:

WARNING - The application you are adding to the MS-DOS version table may not
have been verified by Microsoft on this version of MS-DOS. Please contact your
software vendor for information on whether this application will operate
properly under this version of MS-DOS. If you execute this application by
instructing MS-DOS to report a different MS-DOS version number, you may lose or
corrupt data, or cause system instabilities. In that circumstance, Microsoft is
not responsible for any loss or damage.

Version table successfully updated

The version change will take effect the next time you restart your system.

To verify that the application has been added to the version table, execute SETVER again without switches or parameters. The added application appears at the end of the list. The modified table takes effect, however, only after you restart or reboot your computer.

If you later decide to delete a program from the version list, use the /D switch and the filename parameter. To delete GOODPROG.EXE from the version table, for example, type one of the following commands at the command line and press Enter:

SETVER GOODPROG.EXE /DELETE

SETVER GOODPROG.EXE /D

DOS deletes the application name from the version table and displays this message:

Version table successfully updated

The version change takes effect the next time you start your system.

Tip

If you are using a batch file to delete a program name from the version table, you might want to suppress the preceding message. To prevent this message from appearing onscreen, add the /QUIET switch in addition to the /DELETE switch.

Displaying Memory Statistics

One of the handiest DOS commands is MEM. This external command enables you to determine how memory is being used on your system. (For a discussion of the types of memory in your system, see Chapter 1, “DOS and the Personal Computer.”)

Issuing the MEM Command

The following line shows the syntax for the MEM command:

MEM /DEBUG /CLASSIFY /FREE /MODULE:programname /PAGE

All switches are optional, and you will find it handy to abbreviate each switch by typing only the first letter (/D, /C, /F, /M:programname, /P). Each switch is independent, meaning that you cannot use them together. The only exception is the /PAGE switch, which tells DOS to pause at the end of each screen it displays. This switch is handy to use because the output generated by MEM can easily run longer than a single screen.

The /DEBUG switch lists all the loaded programs and device drivers. This listing includes the name, size, position, and type of each item.

The /CLASSIFY switch lists the programs loaded into conventional memory as well as in upper memory—the 384KB area of memory between 640KB and 1MB that is usually reserved for use by certain system devices, such as your monitor.

The /FREE switch lists the free areas of conventional and upper memory. The /MODULE: programname switch shows the way a program module is currently using memory. You must specify the program name after the /MODULE switch. The MEM /MODULE switch lists the areas of memory the program module is using and shows the address and size of each area.

Understanding the Operation of MEM

To see a “short” version of the memory report that indicates the amount of conventional memory, EMS memory, and XMS memory, just enter MEM at the DOS prompt, without any switches. DOS displays a report similar to this one:

Memory Type        Total  =   Used  +   Free
---------------   -------   -------   -------
Conventional         640K       79K      562K
Upper                 71K       33K       38K
Reserved             384K      384K        0K
Extended (XMS)*    7,097K    2,537K    4,560K
---------------   -------   -------   -------
Total memory       8,192K    3,033K    5,159K

Total under 1 MB     711K      112K      599K

Total Expanded (EMS)                7,488K (7,667,712 bytes)
Free Expanded (EMS)*                4,800K (4,915,200 bytes)

* EMM386 is using XMS memory to simulate EMS memory as needed.
  Free EMS memory may change as free XMS memory changes.

Largest executable program size       561K (574,752 bytes)
Largest free upper memory block        22K  (22,016 bytes)
MS-DOS is resident in the high memory area.

This report gives you three types of information about every type of memory in your system, in three columns: the total amount, the amount currently being used, and the memory available for you to use for programs.

The first line describes the conventional memory: the total amount (generally 640KB; 1KB = 1,024 bytes), the amount of memory currently being used, and the amount of free memory. The next line shows you the amount of upper (reserved) memory and adapter RAM/ROM in the same format. These two amounts total 384KB, which, in addition to the conventional memory, is the total amount of memory that DOS addresses—1,024KB.

The MEM report then tells you the total amount of extended memory that has been mapped (converted) to XMS memory, the amount currently in use, and the amount available for use. In the example, 4,560KB of XMS memory of the original 7,097KB are available.

The next line shows the total amount of memory under 1MB and the amount available to you for running programs. This amount might be misleading because the figure lumps together the amount of free conventional and free reserved memory. Most programs cannot use both of these types of memory as if they were contiguous.

The first two long lines following the totals show the total amount and free amount of expanded memory in your system. A footnote explains that the EMM386.EXE memory manager creates expanded memory from the pool of XMS memory as needed. Finally, MEM indicates whether MS-DOS currently is loaded in the high memory area.

Sometimes, MEM's short report doesn't provide enough information to meet your needs. MEM therefore provides three switches to produce longer versions of the report. Because these reports don't fit on a single screen, you can use the /PAGE switch to display one page of the report at a time.

The reports generated by MEM's /CLASSIFY and /DEBUG switches are highly technical in content. For example, to execute the MEM command with the /DEBUG switch, enter the following line at the DOS prompt:

MEM /DEBUG

A report similar to this one appears:

Conventional Memory Detail:

  Segment               Total        Name         Type
  -------               -----        ----         ----
   00000              1,039    (1K)               Interrupt Vector
   00040                271    (0K)               ROM Communication Area
   00050                527    (1K)               DOS Communication Area
   00070              2,752    (3K)  IO           System Data
                                        CON       System Device Driver
                                        AUX       System Device Driver
                                        PRN       System Device Driver
                                        CLOCK$    System Device Driver
                                        A: - D:   System Device Driver
                                        COM1      System Device Driver
                                        LPT1      System Device Driver
                                        LPT2      System Device Driver
                                        LPT3      System Device Driver
                                        COM2      System Device Driver
                                        COM3      System Device Driver
                                        COM4      System Device Driver
   0011C              5,600    (5K)  MSDOS        System Data
   0027A             49,712   (49K)  IO           System Data
                      1,152    (1K)     XMSXXXX0  Installed Device=HIMEM
                      3,104    (3K)     EMMXXXX0  Installed Device=EMM386
                     37,648   (37K)     DBLSYSH$  Installed Device=DBLSPACE
                      1,600    (2K)               FILES=32
                        256    (0K)               FCBS=4
                        512    (1K)               BUFFERS=10
                      2,288    (2K)               LASTDRIVE=Z
                      3,008    (3K)               STACKS=9,256
   00E9D                 80    (0K)  MSDOS        System Program
   00EA2              2,656    (3K)  COMMAND      Program
   00F48                 80    (0K)  MSDOS        -- Free --
   00F4D                528    (1K)  COMMAND      Environment
   00F6E                128    (0K)  MSDOS        -- Free --
   00F76             17,088   (17K)  MOUSE        Program
   013A2                160    (0K)  MEM          Environment
   013AC             88,992   (87K)  MEM          Program
   02966            485,776  (474K)  MSDOS        -- Free --

Upper Memory Detail:

  Segment  Region       Total        Name         Type
  -------  ------   ---------------  ----------   --------
   0CD4A       1        800    (1K)  IO           System Data
                        768    (1K)     SETVERXX  Installed Device=SETVER
   0CD7C       1      4,224    (4K)  IO           System Data
                      4,192    (4K)     CON       Installed Device=ANSI
   0CE84       1         48    (0K)  MSDOS        -- Free --
   0CE87       1     29,024   (28K)  SMARTDRV     Program
   0D59D       1     16,432   (16K)  MSDOS        -- Free --
   0D9A0       1     22,016   (22K)  MSDOS        -- Free --
Memory Summary:

  Type of Memory       Total   =    Used    +    Free
  ----------------  ----------   ----------   ----------
  Conventional         655,360       80,384      574,976
  Upper                 72,576       34,080       38,496
  Reserved             393,216      393,216            0
  Extended (XMS)*    7,267,456    2,598,016    4,669,440
  ----------------  ----------   ----------   ----------
  Total memory       8,388,608    3,105,696    5,282,912

  Total under 1 MB     727,936      114,464      613,472

  Handle      EMS Name      Size
  ------      --------      ----
        0                  060000

  Total Expanded (EMS)                 7,667,712 (7,488K)
  Free Expanded (EMS)*                 4,915,200 (4,800K)

  * EMM386 is using XMS memory to simulate EMS memory as needed.
    Free EMS memory may change as free XMS memory changes.

  Memory accessible using Int 15h              0     (0K)
  Largest executable program size        574,752   (561K)
  Largest free upper memory block         22,016    (22K)
  MS-DOS is resident in the high memory area.

  XMS version  3.00; driver version  3.16
  EMS version  4.00

The first column shows the starting address of each item that MEM found. The address is listed in hexadecimal (base 16) notation. The second column shows the size, in kilobytes, of each program or driver. The third column shows the name of the program or device driver loaded into memory. The final column includes the type of item listed. The types include the system files IO.SYS, MSDOS.SYS, and COMMAND.COM; programs; installed device drivers and system device drivers; environment; and any data areas the programs might need.

To see a listing of programs, drivers, and free space in conventional and upper memory, type the following command and press Enter:

MEM /C

DOS shows you a report similar to this one:

Modules using memory below 1 MB:

  Name           Total       =   Conventional   +   Upper Memory
  --------  ----------------   ----------------   ----------------
  MSDOS       18,029   (18K)     18,029   (18K)          0    (0K)
  HIMEM        1,168    (1K)      1,168    (1K)          0    (0K)
  EMM386       3,120    (3K)      3,120    (3K)          0    (0K)
  DBLSPACE    37,664   (37K)     37,664   (37K)          0    (0K)
  COMMAND      3,184    (3K)      3,184    (3K)          0    (0K)
  MOUSE       17,088   (17K)     17,088   (17K)          0    (0K)
  SETVER         816    (1K)          0    (0K)        816    (1K)
  ANSI         4,240    (4K)          0    (0K)      4,240    (4K)
  SMARTDRV    29,024   (28K)          0    (0K)     29,024   (28K)
  Free       613,472  (599K)    574,976  (562K)     38,496   (38K)

Memory Summary:

  Type of Memory       Total   =    Used    +    Free
  ----------------  ----------   ----------   ----------
  Conventional         655,360       80,384      574,976
  Upper                 72,576       34,080       38,496
  Reserved             393,216      393,216            0
  Extended (XMS)*    7,267,456    2,598,016    4,669,440
  ----------------  ----------   ----------   ----------
  Total memory       8,388,608    3,105,696    5,282,912

  Total under 1 MB     727,936      114,464      613,472

  Total Expanded (EMS)                 7,667,712 (7,488K)
  Free Expanded (EMS)*                 4,915,200 (4,800K)

  * EMM386 is using XMS memory to simulate EMS memory as needed.
    Free EMS memory may change as free XMS memory changes.

  Largest executable program size        574,752   (561K)
  Largest free upper memory block         22,016    (22K)
  MS-DOS is resident in the high memory area.

Tip

Because some of the report scrolls off the screen before you can read it, you might want to use the /P switch to tell DOS to pause after each page. To do so, type the following line:

MEM /C /P

DOS displays the report one page at a time. Press any key when you are ready to display the next page.

The third and fourth columns of the report, titled Conventional and Upper Memory, show you how much memory is allocated to any particular driver or program. Use the Upper Memory column to determine whether any drivers or programs are loaded in upper memory, and use the Memory Summary at the end of the report to see how much upper memory is still free.

Before attempting to move a driver or program from conventional to upper memory (using DEVICEHIGH or LOADHIGH), compare the driver or program's size (in the Conventional memory size column) to the available upper memory block (UMB) size shown at the bottom of the memory summary. The available UMB must be at least as big as the driver or program before you can load the driver or program into upper memory.

A quick way to see a listing of free memory space without searching through one of the longer reports is to use the /FREE switch, as shown in the following line:

MEM /F

If you use this switch, MEM lists the free areas of conventional and upper memory. This report shows you the segment address and size of each free area of conventional memory and the largest free block in each region of upper memory. The switch also summarizes your overall memory use. A sample of the report follows:

Free Conventional Memory:

  Segment         Total
  -------   -----------------
   00F48           80    (0K)
   00F6E          128    (0K)
   013A2          160    (0K)
   013AC       88,992   (87K)
   02966      485,776  (474K)

  Total Free: 575,136  (562K)

Free Upper Memory:

  Region   Largest Free     Total Free      Total Size
  ------  --------------  --------------  --------------
      1    22,016  (22K)   38,496  (38K)   72,576  (71K)

After you identify a driver or memory-resident program that appears to be the right size to fit in the available UMB, edit CONFIG.SYS or AUTOEXEC.BAT to add DEVICEHIGH or LOADHIGH to the appropriate command or program file. Reboot your computer and issue the MEM /C command again to see whether the driver or program loaded.

To arrive at the best combination of device drivers and memory-resident programs loaded into upper memory, you might have to experiment a little. DOS loads programs into the largest available UMB first, so try loading the largest drivers and programs first by placing their startup commands earliest in CONFIG.SYS or AUTOEXEC.BAT.

Loading a Secondary Command Processor

The COMMAND command enables you to load a second copy of COMMAND.COM, the system's command processor. Many programs load this processor automatically when they enable you to go to a DOS command prompt without exiting the program. Although you might not have much need to load another command processor in your everyday use of DOS, you might want to do so from within a batch file so that you can run another program in its own environment.

Issuing the COMMAND Command

The syntax for COMMAND is shown here:

COMMAND d:path  /P /MSG /E:aaaaa /C string /K<command>

For this command, d:path is the drive and path position of the COMMAND.COM file you are loading. The other parameters are explained briefly in the list that follows and in more detail in the next section:

Parameter Description
/P Makes the second copy of the command processor permanent
/MSG Causes DOS to load DOS messages into memory instead of reading the messages from disk every time they are needed
/E:aaaaa Enables you to adjust the number of bytes of memory that the command processor reserves for its environment
/C string Enables you to pass a string of characters to the command processor being started
/Y Directs COMMAND.COM to step through the batch file specified by the /C or /K switch
/K Causes the program or named batch file to be run, with the system prompt that belongs to this second iteration of COMMAND.COM being displayed after the program terminates

Understanding the Operation of COMMAND.COM

COMMAND.COM, your command processor, reserves a small amount of memory called the environment. It uses this memory space to store variables, such as your PATH, PROMPT, and COMSPEC settings. If you load another copy of COMMAND.COM but omit the d:path parameter, the second command processor inherits the contents of the first command processor's environment. If you include the d:path parameter, the second command processor does not inherit the old environment and keeps only the COMSPEC path specified by d:path.

After you start a secondary command processor, you exit it and return to the first command processor by using the EXIT command. When you leave the second command processor, the first command processor's environment remains unchanged, even if you changed the second command processor's environment while you were working with it.

The optional /P switch makes the second copy of the command processor permanent. The first command processor is no longer available, and DOS runs your AUTOEXEC.BAT file if you have one. Remember, if you use the /P switch, you cannot use the EXIT command to exit the second copy of the command processor and return to the first one. You have to turn off your computer and reboot.

The /MSG switch causes DOS to load DOS messages into memory instead of reading the messages from the disk every time they are needed. Using this switch improves the performance of DOS, but you lose some memory space.

The /E:aaaaa switch enables you to adjust the number of bytes of memory that the command processor reserves for its environment. The minimum value for aaaaa is 160, and the maximum is 32768. The default is 256 bytes. (The recommended minimum value in a Windows environment is 512 bytes.) Each variable stored in the environment takes up space, and you might find that you run out of room in the environment. If, for example, the environment needs to store long settings (such as the long prompt used in the earlier PROMPT command example), you might have to adjust the size of the environment. If you see the message Out of environment space, enlarge the environment.

The /C string option enables you to pass a string of characters to the command processor you are starting. This option generally was used in batch files (see Chapter 16, “Understanding Batch Files”) in DOS versions before 3.3 but is no longer needed with DOS 3.3 and later versions, in which it has been replaced by the CALL command.

Tip

If you are using DOS 6.22, and you use the /C switch to run a batch file under the new command processor, you also can use the /Y switch to instruct COMMAND.COM to single-step through the batch file. This procedure is similar to the single-stepping of AUTOEXEC.BAT you can do when you first boot DOS. For more information on how single-stepping works, refer to Chapter 2.

Using EXIT to Leave the Current Copy of the Command Processor

Use the EXIT command to leave the current copy of the command processor and return to the previously loaded copy. The syntax for the EXIT command is as follows:

EXIT

No options or switches exist for this command. You cannot use the EXIT command if the second command processor was started by using the /P switch.

Uses for a Secondary Command Processor

Used together, the COMMAND and EXIT commands provide two interesting uses. If you have specified an alternative location with the file COMMAND.COM, you use COMMAND to load the second processor. If, for example, the DOS command processor is in the root directory and another command processor is loaded in the OTHER subdirectory, you can enter the following command:

COMMAND C:OTHER /E:320

This command loads the second COMMAND.COM and assigns it an environment size of 320 bytes. You can use the second command processor to execute commands using the 320-byte environment. When you are finished using the secondary command processor, type EXIT to return to the primary command processor.

You also can use this command pair when you have set up a complex environment and you want to execute a command with a basic environment without changing the existing environment. In this case, you can start the second command processor by using the d:path option. If necessary, you can change the environment by using the SET command, covered in Chapter 11, “Controlling Your Environment.” Execute the desired commands in the altered environment and then exit the second command processor.

If the command processor is in the root directory of drive C, enter the following command:

COMMAND C:

This command loads a second copy of the command processor. The new environment includes only a setting for COMSPEC, showing that the command processor is loaded in C:. The prompt does not have a setting and shows up in the form C>. You then execute any desired commands in the new environment. After you finish issuing the commands, type EXIT to exit the second command processor and return to the first command processor. All the environment settings for the first command processor stay as they were originally.

The principles DOS uses to execute this command are also used by applications programs that enable you to suspend your program temporarily and go to DOS. When you select the DOSSHELL command within your word processor, for example, the program starts a second command processor. All the existing information is kept in memory with the first command processor. You execute DOS commands in the second command processor and type EXIT when the commands are complete. The first command processor is then active, and you return to your application program.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.103.96