"Out of Environment Space" Running Batch File or Command Prompt

Article translations Article translations
Article ID: 261825
Expand all | Collapse all

On This Page


When you start a batch file or use a command prompt, you may receive the following error message:
Out of environment space


The default space for environment variables is 256 bytes by default. More environment variables are being set than can fit in 256 bytes.


To work around this issue, use one of the following methods:

Method 1

  1. Right-click the MS-DOS Prompt shortcut, and then click Properties.
  2. Click the Memory tab.
  3. In the Initial Environment box, set the initial environment size you want (from 256 to 4,096 bytes, in 256-byte increments).
  4. Click OK.

Method 2

Edit the Autoexec.bat file to include any environment variables that you need to set, and then reboot the computer. The changes are incorporated into the registry and the environment variable size is increased.

More information

Windows Millennium Edition ignores Config.sys statements to increase the environment variable size.

For a list of command-line options, type command.com /?.


Article ID: 261825 - Last Review: June 19, 2014 - Revision: 2.0
kberrmsg kbprb kbshell KB261825
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com