Category:MSX-DOS 2 Environment Variables
This page was last modified 19:27, 5 June 2020 by Mars2000you.

Contents

Description

MSX-DOS 2 works with environment variables or big parameters defining its work environment. Several environment variables are provided with the system, and you can modify their values, but you can also create your own environment variables.

Creation, modification and deletion

To create a new environment variable or modify / delete an existing environment variable, you need to use the SET command. It can be done on the command line, but also in batch files, and using of aliases is possible since COMMAND2.COM 2.40.

An environment variable can have any name chosen by the user, and can consist of the same characters that are valid in a file name. The maximum length of an environment variable name is 255 characters.

You need also to specify or modify the value corresponding to the environment variable. The value of an environment variable is simply a string of arbitrary characters up to a maximum length of 255. No processing is performed on the characters and so the casing of characters is preserved.

Since COMMAND2.COM 2.40, internal variables and internal variable functions can be part of the value corresponding to an environment variable. You can also read a single keystroke or a string from the keyboard and place it in an environment variable with the INKEY and INPUT commands.

Usage with COMMAND2.COM 2.31 and higher

  • The contents of any environment variable, placed between two % characters, can be examined from the command line with a command like this: A:\>ECHO %Variable%
  • If you embed a variable in the PROMPT environment variable, it must be enclosed in either single (') or double quotes (").
  • If you use the INKEY and INPUT commands (with COMMAND2.COM 2.40 and higher), check the mentioned pages for the appropriates syntaxes.
  • If the value of an environment variable includes internal variables and/or internal variable functions (when you use COMMAND2.COM 2.40 and higher), you must respect the syntax that needs to be applied for these internal variables and variable functions.

List of provided Environment Variables

MSX-DOS 2 provides several environment variables, most of them have a default value, that can be modified at the launching by appropriate commands in the AUTOEXEC.BAT and REBOOT.BAT files.

At any moment, you can use the SET command without parameter to get the list of the currently defined environment variables with their values.

Version = COMMAND2.COM version that introduces or improves this variable.

Variable Version Default value Related Commands Internal Variables Variable Functions
ALIAS 2.40 ON ALIAS @ALIAS
APPEND 2.20 Not defined
CDPATH 2.40  ; CDD, CDPATH, CHDIR
DATE 2.20 Appropriate format
depending from country
DATE _DATE, _DATEF @FILEDATE
ECHO 2.20 OFF Batch files
EXPAND 2.40 ON
EXPERT 2.30 - 2.40 Not defined in 2.3x
ON since 2.40
HELP 2.20 A:\HELP HELP
KHELP 2.20
Removed in 2.4x
A:\KHELP HELP
LOWER 2.40 OFF _BOOT, _CWD,
_CWDS, _CWP,
_CWPS, _DISK
and _DIRBUFFER
PARAMETERS 2.20 Not defined
PATH 2.20  ; PATH
PROGRAM 2.20 Not defined
PROMPT 2.20 - 2.40 OFF in 2.2x and 2.3x
ON or %_CWD% in 2.4x
_CWD,_DISK
PUSHD 2.40 Not defined POPD, PUSHD
REDIR 2.20 ON
SEPAR 2.40 ON
SHELL 2.20 Not defined COMMAND2, EXIT _SHELL
TABORDER 2.41 BOTH
TEMP 2.20 A:\
TIME 2.20 - 2.40 12 in 2.2x and 2.3x
24 since 2.40
TIME _TIME @FILETIME
UPPER 2.20 OFF @LOWER, @UPPER