Special Character Compatibility
If you use two or more of our products, or if you want to share aliases
and batch files with users of different products, you need to be aware of
the differences in three important characters: the Command Separator (see
Multiple Commands), the Escape Character (see Escape Character), and the
Parameter Character (see Batch File Parameters).
The default values of each of these characters in each product is shown in
the following chart:
Product Separator Escape Parameter
4DOS, Take Command/16 ^ ^ &
4NT, CMD.EXE, & ^ $
Take Command/32,
Take Command for OS/2
The up-arrow [^] represents the ASCII Ctrl-X character, numeric value 24.)
In your batch files and aliases, and even at the command line, you can
smooth over these differences in three ways:
* Select a consistent set of characters from the Options 1 page
of the OPTION dialogs, or with .INI file configuration
directives command. For example, to set the CMD.EXE
characters to match 4DOS, use these lines in CMD.INI:
CommandSep = ^
EscapeChar = ^
ParameterChar = &
* Use internal variables that contain the current special
character, rather than using the character itself (see + and
=). For example, this command:
if "%1" == "" (echo Argument missing! ^ quit)
will only work if the command separator is a caret. However,
this version works regardless of the current command
separator:
if "%1" == "" (echo Argument missing! %+ quit)
* In a batch file, use the SETLOCAL command to save the command
separator, escape character, and parameter character when the
batch file starts. Then use SETDOS as described above to
select the characters you want to use within the batch file.
Use an ENDLOCAL command at the end of the batch file to
restore the previous settings.
You can also use the SETDOS command to change special characters on the
command line. However, when setting new special character values on the
command line you must take into account the possibility that one of your
new values will have a current meaning that causes problems with the
setting. For example, this command:
[c:\] setdos /p&
would not set the parameter character to an ampersand [&] in CMD.EXE if
the standard CMD.EXE special characters were currently in effect. The &
would be seen as a command separator, and would terminate the SETDOS
command before the parameter character was set. To work around this, use
the escape character variable %= before each setting to ensure that the
following character is not treated with any special meaning.
For example, the following sequence of commands in a batch file will
always set the special characters correctly to their standard 4DOS
values, no matter what their current setting, and will restore them when
the batch file is done:
setlocal
setdos /c%=^ /e%=^ /p%=&
.....
endlocal
A similar sequence can be used to select the standard CMD.EXE and 4NT
characters, regardless of the current settings:
setlocal
setdos /c%=& /e%=^ /p%=$
.....
endlocal
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs