Internal variables are special variables built into TCC to provide information about your system. They are not stored in the environment, but can be accessed as if they were environment variables in interactive commands, aliases, and batch files.

 

The values of these variables are stored internally in TCC, and cannot be changed with the SET, UNSET, ESET or any other command. The DEFINED status test will always fail, too. You can override any of these variables by defining a new environment variable with the same name. The internal variable can be made available again by unsetting the identically name environment variable. The names of ALL internal variables (except the pseudovariables errorlevel, ?, and ??) begin with an underscore character to make it easier to distinguish them and to avoid accidentally overriding them.

 

These internal variables are often used in batch files and aliases to examine system resources and adjust to the current computer settings. You can examine the contents of any internal variable from the command line with a command like this:

 

echo %variablename

 

Variables which return a file or directory name from a volume that supports long filenames return it in the same case as it is stored. Returned names are not quoted automatically, you must add the quotes yourself if they are required by the syntax in which you use them.

 

Some variables return values based on information provided by your operating system. These variables will only return correct information if the operating system provides it. For example, _BATTERY will not return accurate results if your operating system and Advanced Power Management drivers do not provide correct information on battery status to TCC.

 

For a list of internal variables organized by general categories of use, see Internal Variables by Category.

 

Examples

 

You can use internal variables in a wide variety of ways depending on your needs. Here are just a couple of examples:

 

Store the current date and time in a file, then save the output of a DIR command in the same file:

 

echo Directory as of %_date %_time > dirsave

dir >> dirsave

 

Call another batch file if today is Monday:

 

if "%_DOW" == "Mon" call c:\cleanup\weekly.bat