[Toc][Index]

SETLOCAL - Save the environment

 
 Purpose:    Save a copy of the current disk drive, directory, 
             environment, alias list, and special characters. 
             
 Format:     SETLOCAL 
 
 See also:  ENDLOCAL. 
 Usage 
 SETLOCAL is used in batch files to save the default disk drive and 
 directory, the environment, the alias list, and the command separator, 
 escape character, parameter character, decimal separator, and thousands 
 separator.  You can then change their values and later restore the 
 original values with ENDLOCAL. 
 For example, this batch file fragment saves everything, removes all 
 aliases so that user aliases will not affect batch file commands, changes 
 the disk and directory, changes the command separator, runs a program, 
 and then restores the original values: 

 
         setlocal
         unalias *
         cdd d:\test
         setdos /c˜
         program ˜ echo Done!
         endlocal
 
 
 SETLOCAL and ENDLOCAL are not nestable within a batch file.  However, you 
 can have multiple, separate SETLOCAL / ENDLOCAL pairs within a batch 
 file, and nested batch files can each have their own SETLOCAL / ENDLOCAL. 
  You cannot use SETLOCAL in an alias or at the command line. 
 An ENDLOCAL is performed automatically at the end of a batch file if you 
 forget to do so.  If you invoke one batch file from another without using 
 CALL, the first batch file is terminated, and an automatic ENDLOCAL is 
 performed; the second batch file inherits the settings as they were prior 
 to any SETLOCAL. 

Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs