home *** CD-ROM | disk | FTP | other *** search
/ Phoenix CD 2.0 / Phoenix_CD.cdr / 01e / let12.zip / DOSENVN.TXT < prev    next >
Text File  |  1986-06-28  |  7KB  |  119 lines

  1.                     For a Greener Environment
  2.          (PC Magazine Vol 5 No 4 Feb 25, 1986 PC Tutor)
  3.  
  4.      You may encounter the "Out of Environment Space" error message
  5. when using the SET command to set up the environment.  The DOS manual
  6. mentions a limit of 127 bytes if a resident program has been loaded,
  7. but even without using any resident programs, you may have the problem.
  8.      If you have not loaded any resident programs, the DOS manual is
  9. correct: you can sit at your keyboard all day and enter multitudes of
  10. SET commands, gradually filling up your environment to its 32K-byte
  11. maximum limit.  Of course, normal people don't do that.  Normal people
  12. put a PATH command, a PROMPT command, and a bunch of SET commands in
  13. an AUTOEXEC.BAT file.  The whole purpose of batch files is to avoid
  14. having to type a lot of commands manually.  But, as soon as you run an
  15. AUTOEXEC.BAT file, the environment becomes limited to 160 bytes.
  16.      When COMMAND.COM runs a batch file, it allocates a small area of
  17. memory to store the batch file name and other information.  This is
  18. needed to return to execution of the batch file after running commands
  19. and programs within the batch file.  For AUTOEXEC.BAT, this area of
  20. memory is placed 160 bytes after the beginning of the environment that
  21. COMMAND.COM maintains.  Thus, it acts like a brick wall, effectively
  22. preventing the expansion of the environment beyond 160 bytes.
  23.      DOS 3.1 does have a way to enlarge the environment.  What you
  24. must do is use a CONFIG.SYS file to specify COMMAND.COM as a SHELL.
  25. This is done with a line in the CONFIG.SYS file that reads:
  26. SHELL=COMMAND.COM /P /E:62.  Without the /P parameter, COMMAND.COM
  27. would not execute the AUTOEXEC.BAT file.  (This is something that goes
  28. back to DOS 2.0.)  The /E parameter is new with DOS 3.1.  The value
  29. following the colon is the number of 16-byte paragraphs reserved for
  30. the environment.  The default is 10 paragraphs (160 bytes) and the
  31. maximum is 62 (992 bytes).  (If you set the value below 10 or above 62,
  32. COMMAND.COM will use the default of 10.)
  33.      Where can you find this documented?  If you load DOS 3.1
  34. COMMAND.COM under DEBUG and unassemble the code beginning at offset
  35. address 0E16, it is obvious.
  36.      The DOS environment has yet to be fully exploited.  Some compilers
  37. and assemblers search the environment for directories where library and
  38. include files may be found, but the environment can also serve as an
  39. all-purpose configuration file for application programs, as well.  An
  40. undocumented feature of DOS 2.0 and above allows environment strings
  41. to be used as replaceable parameters in batch files -- most usefully
  42. in conjunction with the IF statement.  For example, if you have a
  43. batch file that must do one of two different things depending upon
  44. whether ANSI.SYS has been loaded or not, you could use SET to create
  45. an environment string with this information:  SET ANSI=ON  or
  46. SET ANSI=OFF.  You could then check for his in a batch file, with the
  47. statement:  IF %ANSI%==ON GOTO label.  If COMMAND.COM finds ANSI in
  48. the environment, it replaces it with the set string when the batch
  49. file is processed.  If ANSI had been set ON, the GOTO is executed; if
  50. set to OFF, the next statement is processed.
  51.      This undocumented feature works with DOS versions 2.0, 2.1 and
  52. 3.1, but a bug in 3.0 makes COMMAND.COM stop reading the batch file
  53. line after it replaces the parameter.
  54.  
  55.  
  56.                       For Environmentalists
  57.                (PC World April 1986 Star-Dot-Star)
  58.  
  59.      DOS generally provides an insufficient amount of environment
  60. string space.  Environment string space is a block of memory that DOS
  61. reserves to hold names and parameters, such as COMSPEC = parameter,
  62. PATH = parameter(s), and PROMPT = parameter(s).  This arrangement
  63. enables all DOS commands and applications to be "aware" of the current
  64. status of the environment (see the SET command in the DOS manual).
  65. COMMAND.COM can be patched to expand that space, but DOS 3.1 includes
  66. an undocumented parameter that does the job more efficiently.
  67.      That parameter is /E:nn, where nn is a decimal value indicating
  68. the number of 16-byte paragraphs to be allocated as environment space.
  69. The minimum value permitted is 10 (160 bytes), the maximum is 62 (992
  70. bytes).  To use this feature, put the statement:
  71.  
  72. SHELL = [d:][path] COMMAND.COM /P/E:nn
  73.  
  74. into the CONFIG.SYS file on your DOS disk.  [d:] and [path] represent
  75. the disk drive and path you want DOS to use when loading COMMAND.COM,
  76. and nn represents the desired number of 16-byte paragraphs to be
  77. allocated to environment space.
  78.      When you start the computer, the SHELL command will load
  79. COMMAND.COM using the /E parameter to allocate the specified amount
  80. of environment space and the /P parameter to make COMMAND.COM the
  81. primary command processor.
  82.      Note that if you specify an invalid number of paragraphs, you
  83. will not receive an error message; the allocation simply will not take
  84. place.  This is an undocumented feature -- use it with caution.
  85.  
  86. -----------------------------------------------------------------
  87.                      RAM Disks Take Command
  88.               (PC World The Help Screen June 1986)
  89.  
  90.      A user put COMMAND.COM in a RAM disk so that DOS could reload
  91. COMMAND.COM quickly rather than issue the prompt "Insert COMMAND.COM
  92. disk in drive A: and strike any key when ready" or "Invalid COMMAND.COM
  93. in drive A:".  The solution for a way to tell DOS that COMMAND.COM was
  94. on drive C: was to issue the command COMMAND C:\ after copying
  95. COMMAND.COM to drive C:.  The explanation:
  96.  
  97.      COMMAND.COM is the DOS command processor.  It loads automatically
  98. from the default drive - usually drive A: - when you start a computer.
  99. The command COMMAND C:\ causes DOS to load a new copy of COMMAND.COM
  100. from the root directory of drive C:.  This secondary command processor
  101. runs under the first.  DOS maintains an environment table that stores
  102. the drive, directory, and name of each command processor it loads.
  103. When it needs to reload a particular command processor, it checks the
  104. related environment table to locate the appropriate command processor
  105. file.
  106.      While this technique reloads COMMAND.COM from drive C:, it wastes
  107. memory.  You don't need to load a secondary command processor.  You
  108. only need DOS to use the copy of COMMAND.COM that resides on drive C:.
  109. If you're using DOS 3.0 or later, load it as you before you tried your
  110. solution.  Next, copy COMMAND.COM to drive C:.  Follow that by typing
  111. SET COMPEC=C:\COMMAND.COM <Enter> to change the environment table.
  112. (You can view the contents of the environment table by typing SET
  113. <Enter>.)  DOS will now use the copy of COMMAND.COM in drive C:
  114. whenever it needs to reload the command processor.
  115.      In earlier versions of DOS the SET command does not work right.
  116. You can use CMDFIX.COM (PC World July 1985 Star-Dot-Star) instead of
  117. the SET command to change the COMSPEC entry in the environment table.
  118.