SETLOCAL
Starts localizing environment changes made in a batch file.
SETLOCAL [ENABLEEXTENSIONS | DISABLEEXTENSIONS] [ENABLEDELAYEDEXPANSION | DISABLEDELAYEDEXPANSION]
Where:
ENABLEEXTENSIONS
- Enables prompt extensions.DISABLEEXTENSIONS
- Disables prompt extensions.ENABLEDELAYEDEXPANSION
- Enable delayed environment variable expansion.DISABLEDELAYEDEXPANSION
- Disable delayed environment variable expansion.
Environment changes made after running SETLOCAL
are local to the batch file. The ENABLEEXTENSIONS
and DISABLEEXTENSIONS
options take precedence over the /E
option of CMDCMD, while the ENABLEDELAYEDEXPANSION
and DISABLEDELAYEDEXPANSION
options take precedence over the /V
option of CMD
. See also ENDLOCALENDLOCAL.
Examples:
1. Enable command prompt extensions (in local batch file):
setlocal enableextensions
2. Enable delayed environment variable expansion (in local batch file):
setlocal enabledelayedexpansion
3. Disable delayed environment variable expansion (in local batch file):
setlocal disabledelayedexpansion
Comments