HKLM\SOFTWARE\Microsoft\Command Processor

Data type Range Default value
REG_DWORD 0 | 1 0


Determines whether the command processor supports delayed expansion of environment variables. If the value of this entry is 1, the command processor interprets an exclamation mark, !, as an environment variable that is expanded only when used.

By default, the command processor expands variables when it reads a line of text. However, you can direct the command processor to expand a variable only when it is used. This permits you to include variables in compound conditional statements, and prevent them from being set before they are tested.

Value Meaning
0 Delayed expansion is not supported. The command processor expands environment variables when it reads them. It does not support exclamation marks as delayed variables.
1 Delayed expansion is supported. The system expands environment variables surrounded by exclamation marks, such as !VAR!, only when they are used.

Change method

To change the value of this entry, start the Command Processor (Cmd.exe) and type cmd /v:on.

Note Image Note

DelayedExpansion can appear in HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER. If both appear in the registry, the value of the entry in HKEY_CURRENT_USER takes precedence over the value in HKEY_LOCAL_MACHINE.

Windows 2000 does not add this entry to the registry. You can add it by editing the registry or by using a program that edits the registry. Even when this entry appears in the registry, the setting of the command line switch, /V, takes precedence over this value.

Tip Image Tip

For more details, start the Command Processor (Cmd.exe) and type help set or type cmd /? and read the entry on the /V command.

Related Entries

Page Image