home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / pc / doshelp / helpsb.zoo / help / batch / hints / variable / summary.hlp < prev   
Encoding:
Text File  |  1989-01-01  |  1.8 KB  |  37 lines

  1.                        ENVIRONMENT VARIABLES
  2.  
  3. Environment variables which have previously been defined in the DOS
  4. environment space by the SET command or other programs can be referenced in
  5. BATCH files by prefixing and suffixing the defined name with a per cent sign
  6. (%). If a variable is SET during the execution of a BATCH file, the value
  7. is preserved until the variable is reSET, except in the case of a BATCH file
  8. executed by COMMAND /C or CALL. All DOS environment space changes made by 
  9. such a BATCH file are lost when it EXITs.
  10.  
  11. Every occurrence of %NAME% in a BATCH file will be replaced by the value of
  12. the variable NAME. The name of a variable may appear anywhere in the BATCH
  13. file, and can be used to insert filenames, commands to be executed, or 
  14. strings to be searched for in the BATCH file. The value can have spaces. The
  15. value assigned to the variable can have |, <, or > in it, if the value is
  16. surrounded by double quotes (") when SET, but will not be interpreted as 
  17. piping or redirection when referenced in a BATCH file.
  18.  
  19. An environment variable COMSPEC is automatically created in the DOS
  20. environment space to save the program name from the SHELL line in the
  21. CONFIG.SYS file. The PATH and PROMPT commands also automatically create 
  22. variables, named PATH and PROMPT. The APPEND /E command creates a variable, 
  23. named APPEND.
  24.  
  25. NOTE: If you ever want to include the character '%' in a batch file, in a 
  26. message to be displayed on the screen for example, you need to include it 
  27. twice to get it displayed once. For example, if the variable COMPLETENESS 
  28. had been set to 100, the command
  29.  
  30.       ECHO  processing %COMPLETENESS%%% complete
  31.  
  32. in a batch file will display the message
  33.  
  34.       processing 100% complete
  35.  
  36. on the screen.
  37.