[Toc][Index]

Using Environment Variables


Batch files can also use environment variables, internal variables, and 
variable functions. You can use these variables and functions to determine 
system status (e.g., the type of CPU in the system), resource levels 
(e.g., the amount of free disk space), file information (e.g., the date 
and time a file was last modified), and other information (e.g., the 
current date and time).  You can also perform arithmetic operations 
(including date and time arithmetic), manipulate strings and substrings, 
extract parts of a filename, and read and write files. 
To create temporary variables for use inside a batch file, just use the 
SET command to store the information you want in an environment variable. 
 Pick a variable name that isn't likely to be in use by some other program 
(for example, PATH would be a bad choice), and use the UNSET command to 
remove these variables from the environment at the end of your batch file. 
 You can use SETLOCAL and ENDLOCAL to create a "local" environment so that 
the original environment will be restored when your batch file is 
finished. 
Environment variables used in a batch file may contain either numbers or 
text.  It is up to you to keep track of what's in each variable and use it 
appropriately; if you don't (for example, if you use %@EVAL to add a 
number to a text string), you'll get an error message. 

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