Optional

There is a way to check the environment size without the use of special programs like ENVIRON.EXE and QENV.BAT. It is not simple because we cannot display the environment size by using a command.

The SET command shows all the current settings in the environment of COMMAND.COM. The environment size defaults to approximately 150 bytes.

  • To make sure that the environment buffer is full, issue some environment settings like:
    SET a=12345678901234567890
    SET b=12345678901234567890
    SET c=12345678901234567890
     :    :   =       :                   :
     :    :   =       :                   :
     :    :   =       :                   :

  • Execute the SET commands until you encounter an error message "Out of environment space".

  • Now, save the environment settings in a file. The syntax for this action is as follows:
    SET  >  MYENV.TXT

  • Check the size of the new file (MYENV.TXT) with the DIR command:
    DIR  MYENV.TXT

  • From the file size displayed by the DIR command, subtract the number of lines in MYENV.TXT.

    This is necessary because each line in the file is terminated by CrLF (0D0A) characters and the environment strings are terminated by a single character (hex 0) only.

    If you can use this method and calculate a size at 200, you did very, very well.

    Figure "C Source Code for ENVIRON.EXE"


    [Back: Expected Results]
    [Next: Lab Session 2: Reboot Virtual DOS Machine]