Microsoft KB Archive/68927

= Effect of Spawning COMMAND.COM on the Environment =

Article ID: 68927

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft MS-DOS 3.1
 * Microsoft MS-DOS 3.2 Standard Edition
 * Microsoft MS-DOS 3.21 Standard Edition
 * Microsoft MS-DOS 3.3 Standard Edition
 * Microsoft MS-DOS 3.3a
 * Microsoft MS-DOS 4.0 Standard Edition
 * Microsoft MS-DOS 4.01 Standard Edition
 * Microsoft MS-DOS 5.0 Standard Edition
 * Microsoft MS-DOS 5.0a
 * Microsoft MS-DOS 6.0 Standard Edition
 * Microsoft MS-DOS 6.2 Standard Edition
 * Microsoft MS-DOS 6.21 Standard Edition
 * Microsoft MS-DOS 6.22 Standard Edition

-



This article was previously published under Q68927



SUMMARY
If you spawn another COMMAND.COM, the child COMMAND.COM has its own environment space allocated to it. The size of this environment space is at least the minimum environment size of 160 bytes. If you start the child COMMAND.COM with the /e: switch, the child's environment space is equal to the indicated in bytes, rounded up to the nearest 16-byte boundary. The maximum allowable environment size is 32,768 bytes.

A copy of the parent process's environment variables are placed in the child's environment space. If the parent's environment variables exceed the space allocated to the child, the child's environment space is automatically increased to allow for the parent's variables. Once again, the environment space is rounded up to the nearest 16-byte boundary. Any changes made to the child's environment have no effect on the parent's environment.



MORE INFORMATION
By using the /e: switch on COMMAND.COM, you can force the allocation of that much memory to the environment. In MS-DOS versions 5.0 and later, a default environment space of 256 bytes is allocated if no /e switch is used (lesser amounts can be specified using the /e: switch). In earlier MS-DOS versions, 160 bytes is the default. The environment can grow beyond the allocated size, but this can occur only if there is free (unallocated) memory available that is contiguous to the currently allocated environment block.

Additional query words: 6.22 3.20 3.21 3.30 3.30a 4.00 4.01 4.01a 5.00 5.00a 6.00 6.20

Keywords: KB68927

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.