Export (0) Print
Expand All

Command Processor\DelayedExpansion

Updated: March 28, 2003

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

HKLM\SOFTWARE\Microsoft\Command Processor

 

Data type Range Default value

REG_DWORD

0 | 1

0

Description

Specifies whether the command processor supports delayed expansion of environment variables. If the value of this entry is 1, then the command processor interprets an exclamation point (!) as an environment variable expands only when used.

By default, the command processor expands variables when it reads a line of text. But you can direct the command processor to expand a variable only when it is used. As a result, you can 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 points as delayed variables.

1

Delayed expansion is supported. The system expands environment variables surrounded by exclamation points (such as !VAR!) only when they are used.

Change Method

You can change the value of this entry by using Command Processor (Cmd.exe) and typing cmd /v:on, but only for the duration of that Cmd.exe's execution. For all other changes, you must use the registry editor Regedit.exe.

Activation Method

If you make changes to the value of this entry by using Regedit.exe, then you must restart Cmd.exe to make the changes effective.

Notes

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

  • Windows Server 2003 does not add this entry to the registry. You can add it by using the registry editor Regedit.exe. Even when this entry appears in the registry, the setting of the command line parameter /V takes precedence over this value.

  • The datatype of this entry can be either REG_DWORD or REG_SZ.

Tip

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

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft