Increase MS-DOS 6.22 Shell Memory

In MS-DOS 6.22, running complex batch files or declaring numerous system variables can trigger the common "Out of environment space" error. This article explains how to increase the command line shell's environment memory by modifying the CONFIG.SYS file. By configuring the SHELL statement with the /E switch, you can allocate the necessary memory for your command interpreter needs.

The Configuration Parameter

To increase shell environment memory, use the SHELL command in CONFIG.SYS alongside the /E: switch. The /E: switch directly controls the number of bytes reserved for the environment space used by COMMAND.COM.

The standard syntax is:

SHELL=C:\DOS\COMMAND.COM C:\DOS\ /E:size /P

Breakdown of the Syntax

  • C:\DOS\COMMAND.COM: Specifies the path to the command interpreter file.
  • C:\DOS\: Specifies where COMMAND.COM should look to reload itself if transient portions of memory are overwritten by applications.
  • /E:size: The specific parameter that dictates the memory allocation in bytes. The valid range is from 160 to 32768. The default allocation in MS-DOS 6.22 is 256 bytes. Common allocations to resolve memory issues are 1024 (1 KB), 2048 (2 KB), or 4096 (4 KB).
  • /P: Tells MS-DOS to make this instance of COMMAND.COM permanent. Without /P, the shell will not automatically execute AUTOEXEC.BAT, and typing EXIT could crash the system.

How to Apply the Setting

  1. Open the MS-DOS text editor by typing EDIT C:\CONFIG.SYS at the command prompt.
  2. Locate any existing line beginning with SHELL=. If it does not exist, add a new line to the file.
  3. Set the line to allocate your desired memory size. For example, to set the environment size to 1,024 bytes:
SHELL=C:\DOS\COMMAND.COM C:\DOS\ /E:1024 /P
  1. Save the changes to CONFIG.SYS and exit the editor.
  2. Reboot the computer for the changes to take effect.