What seems obvious today may have been impractical then

Raymond Chen

In the discussion of the environment variable problem, BryanK posits that the real mistake was allowing batch files to modify their parent environment in the first place. Instead, they should have run in a sub-process. Try saying that when your computer has only 16KB of memory, which is how much memory the original IBM PC came with. Heck, try saying that when your operating system doesn’t even support sub-processes! It wasn’t until MS-DOS 2.0 that the ability to run a process and then regain control after the process exits even existed. MS-DOS 1.0 followed the CP/M model wherein exiting a process freed all the memory in the computer (save for the operating system itself, of course; thank you, nitpickers) and loaded a fresh copy of the command interpreter. There were some checksum hacks to avoid reloading the command interpreter if it didn’t appear to have been modified by the program that just exited.

Besides, if batch files couldn’t modify the environment of the command interpreter, the AUTOEXEC.BAT file would be pretty useless.


Discussion are closed.


Feedback usabilla icon